開発環境
- OS X Lion - Apple(OS)
- Safari、Firefox + Firebug (Webプラウザ、プラグイン)
- BBEdit - Bare Bones Software, Inc.(Text Editor)
- Script言語:JavaScript
- JavaScript Library: jQuery
『初めてのJavaScript 第2版』(シェリー・パワーズ著(Shelley Powers著)、武舎 広幸+武舎 るみ訳、オライリー・ジャパン、2009年、ISBN978-4-87311-425-5) の3章(演算子と文)練習問第3-4.を解いてみる。
その他参考書籍
3-4.
コード(BBEdit)
var result = "",
i = 10;
do {
i += 1;
result += i + "\n";
} while ( i < 19 );
result += "\n";
i = 11;
while ( i < 20 ){
result += i + "\n";
i += 1;
}
result += "\n";
for (i = 11, max = 20; i < max; i += 1) {
result += i + "\n";
}
result += "\n";
i = 11;
$('#pre0').text(result);
ちなみにPython3kの場合。
コード(BBEdit)
sample.py
#!/usr/bin/env python3.3
# -*- coding: utf-8 -*-
for x in range(11, 20):
print(x)
print([x for x in range(11, 20)])
入出力結果(Terminal)
$ ./sample.py 11 12 13 14 15 16 17 18 19 [11, 12, 13, 14, 15, 16, 17, 18, 19] $
0 コメント:
コメントを投稿