Skip to content

Instantly share code, notes, and snippets.

@Headmast
Created October 1, 2020 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Headmast/25b92bfdc1d65b4a75e8c3b3a6a467a2 to your computer and use it in GitHub Desktop.
Save Headmast/25b92bfdc1d65b4a75e8c3b3a6a467a2 to your computer and use it in GitHub Desktop.
import 'dart:io';

void addUp() {
  var input = '';
  double sum = 0;

   do {
     input = stdin.readLineSync();
     double value = double.tryParse(input);
     if (value == null) {
      if (input == 'stop') {
        break;
      }
      print('Incorrect input: ${input}');
      continue;
     }
    sum += value;
    print('Sum: ${sum}');
   } while (true);
}

void main() {
  addUp();
}
@artem-zaitsev
Copy link

да, косяк, не предоставили саму функцию. Учтем

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment