fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 120: Read integer from stdin
Idiom # 120: Read integer from stdin
See
programming-idioms.org
:
Code
n := io.buffered.read_line ? str String => str.parse_int.val | io.end_of_file => panic "end of file"
What are effects?
Running Example
ex120 is say "please type a number:" # NYI: CLEANUP: there should be no need for a mutate effect m : mutate. m.instate_self ()-> # no error handling is performed here # program crashes if user does not type a number _ := (io.stdin m).with ()-> n := io.buffered.read_line m ? str String => str.parse_int.val | io.end_of_file => panic "end of file" say "got $n"
What are effects?
last changed: 2024-07-01
next: NYI: Idiom # 121: UDP listen and read