Read stdin as array

This commit is contained in:
2026-07-10 14:48:13 +02:00
parent c0ed10e872
commit d67096dd30
+3 -3
View File
@@ -2,16 +2,16 @@ module main
import os import os
fn read_stdin() string { fn read_stdin() []string {
mut line := '' mut line := ''
mut inputstr := '' mut inputstr := []string{}
for { for {
line = os.get_line() line = os.get_line()
if line.len == 0 && os.stdin().eof() { if line.len == 0 && os.stdin().eof() {
break break
} }
line = line.trim_space() line = line.trim_space()
inputstr += line inputstr << line
} }
return inputstr return inputstr
} }