|
Oktatás * Programozás 2 * Szkriptnyelvek * Adator. prog. Teaching • Prog. for Data Sci. Félévek Linkek * kalendárium |
Nim2 /
Read lines until EOFWe want to read lines from the standard input until EOF (under Linux: until the user presses Ctrl+d, which indicates the end of the input). Exercise: read lines until EOF and at the end print on the screen the number of lines provided by the user. var cnt = 0 for line in stdin.lines: cnt += 1 # echo cnt Running example: $ ./main aa bb cc <Ctrl+d> # EOF happens here 3 |
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |