tutorial:nim:hello_world
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン | |||
tutorial:nim:hello_world [2024/08/20 02:04] – 削除 - 外部編集 (不明な日付) 127.0.0.1 | tutorial:nim:hello_world [2024/08/20 02:04] (現在) – ↷ tutorial:nim:hello-world から tutorial:nim:hello_world へページを名称変更しました。 freemikan | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== Hello World! ====== | ||
+ | |||
+ | Nimのインストールが無事に終わって'' | ||
+ | |||
+ | <file nim> | ||
+ | echo " | ||
+ | </ | ||
+ | |||
+ | 1行だけと極めてシンプルになっています。この内容のファイルを適当な作業用ディレクトリに、__hello.nim__という名前で保存します。Nimで書かれたプログラムを実行するには、コンパイルを必要とします。'' | ||
+ | |||
+ | <cli> | ||
+ | $ nim c hello.nim | ||
+ | Hint: used config file '/ | ||
+ | Hint: used config file '/ | ||
+ | ...................................................................... | ||
+ | Hint: [Link] | ||
+ | Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d: | ||
+ | 27611 lines; 0.118s; 30.383MiB peakmem; proj: / | ||
+ | </ | ||
+ | |||
+ | やや冗長なメッセージが出力されますが、// | ||
+ | |||
+ | <cli> | ||
+ | $ ./hello | ||
+ | Hello, world! | ||
+ | </ | ||
+ | |||
+ | 期待通りの結果が得られました。 | ||
+ | |||
+ | '' | ||
+ | |||
+ | <cli> | ||
+ | $ nim r hello.nim | ||
+ | Hint: used config file '/ | ||
+ | Hint: used config file '/ | ||
+ | Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d: | ||
+ | 10086 lines; 0.014s; 10.488MiB peakmem; proj: / | ||
+ | Hint: / | ||
+ | Hello, world! | ||
+ | </ | ||
+ | |||
+ | 最下行に// | ||
+ | |||
+ | '' | ||
+ | |||
+ | <cli> | ||
+ | $ nim js hello.nim | ||
+ | Hint: used config file '/ | ||
+ | Hint: used config file '/ | ||
+ | ....................................... | ||
+ | Hint: opt: none (DEBUG BUILD, `-d: | ||
+ | 21576 lines; 0.054s; 19.828MiB peakmem; proj: / | ||
+ | </ | ||
+ | |||
+ | __hello.js__が生成されています。Node.jsでこれを実行することが出来ます。 | ||
+ | |||
+ | <cli> | ||
+ | $ node hello.js | ||
+ | Hello, world! | ||
+ | </ | ||
+ | |||
+ | WebブラウザでHTMLに読み込んで実行することももちろん可能です。 | ||