【Dart】リスト(配列)の合計を求める方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var iterable = [1, 2, 3, 4, 5]; | |
var sum = iterable.reduce((value, element) => value + element); | |
print(sum); // Output: 15 | |
} |
コメント
コメントを投稿