Dart ceilメソッドを使って切り上げを行う

環境
OS windows10 Home 64bit
Dart 2.18.4

書式
数値.ceil()
ceil メソッドを使って数値を切り上げします

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
void main() {
print((31.4).ceil());
print((32.9).ceil());
print((-33.4).ceil());
print((-44.9).ceil());
}
void main() { print((31.4).ceil()); print((32.9).ceil()); print((-33.4).ceil()); print((-44.9).ceil()); }
void main() {
    
  print((31.4).ceil());  
  print((32.9).ceil());
  print((-33.4).ceil());  
  print((-44.9).ceil());
}

実行結果

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
32
33
-33
-44
32 33 -33 -44
32
33
-33
-44

 

Dart

Posted by arkgame