2013年10月29日火曜日

開発環境

初めてのコンピュータサイエンス(Jennifer CampbellPaul GriesJason MontojoGreg Wilson(著)長尾 高弘(翻訳))の2章(Python入門)の2.10(練習問題)、10をDartで解いてみる。

その他参考書籍

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 コメント:

コメントを投稿