開発環境
- OS X Mavericks - Apple (OS)
- Dart Editor (開発環境)
- Dart (プログラミング言語)
初めてのコンピュータサイエンス(Jennifer Campbell、Paul Gries、Jason Montojo、Greg Wilson(著)長尾 高弘(翻訳))の2章(Python入門)の2.10(練習問題)、10をDartで解いてみる。
その他参考書籍
- What is Dart? [Kindle版] (O'Reilly Media) Kathy Walrath Seth Ladd (著) このブログでの感想
10.
コード
sample.dart
import 'dart:math' as math; void main(){ [['math.pow(3, 7) = ', math.pow(3, 7)], ['34.7.floor() = ', 34.7.floor()], ['34.7.toInt() = ', 34.7.toInt()], ['34.7.round() = ', 34.7.round()], ['(-86).abs().toDouble() = ', (-86).abs().toDouble()]].forEach((a){ print('${a[0]}${a[1]}'); }); }
入出力結果
math.pow(3, 7) = 2187 34.7.floor() = 34 34.7.toInt() = 34 34.7.round() = 35 (-86).abs().toDouble() = 86.0
0 コメント:
コメントを投稿