Simple Sand Samples |
説明のないとってもシンプルなサンプルプログラム集
COBOL | awk | C言語 | D言語 | GO言語 | Lua | Vim |
bash | Perl | Gauche | Clojure | CLISP | EmacsLisp | VimScript |
tcsh | Ruby | Groovy | Java | C# | VBScript | JavaScript |
Io言語 | Python | Erlang | Scala | VB.NET | Excel/VBA | PHP |
Tcl | Haskell | OCaml | PowerShell | Windows | Unix/Linux |
Ruby > 連想配列を使う
hash.rb
|
|
$ ruby hash.rb
banana is 100 yen.
keys = ["apple", "banana", "candy"]
dice is 50 yen.
keys = apple banana candy dice
[300, 50]
keys = ["banana", "candy", "dice"]
$
banana is 100 yen.
keys = ["apple", "banana", "candy"]
dice is 50 yen.
keys = apple banana candy dice
[300, 50]
keys = ["banana", "candy", "dice"]
$
* 確認環境 Debian Linux(Jessie)