Skip to content

Instantly share code, notes, and snippets.

@rodion-m
Created March 6, 2021 21:36
Show Gist options
  • Save rodion-m/62400072f6b72bd516e53a4fd1ef30f8 to your computer and use it in GitHub Desktop.
Save rodion-m/62400072f6b72bd516e53a4fd1ef30f8 to your computer and use it in GitHub Desktop.
import 'dart:convert';
import 'dart:io';
void main(List<String> arguments) {
String? input;
var acc = 0.0;
do {
input = stdin.readLineSync(encoding: utf8);
try {
acc += double.parse(input ?? "");
print(acc);
} catch(e) {
acc = 0.0;
print("reseted");
}
} while(input != "stop");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment