type Console = iterative choice { .close => !, .print => [String] self, .prompt => [String] (Option<String>) self, }
An interactive terminal handle.
.close— close the console..print(s)— print a string followed by a newline..prompt(s)— print a prompt string (no newline), read a line from stdin. Returns.okwith the input (trailing newline stripped), or.err!on EOF.
let console = Console.Open
console.print("Hello!")
console.prompt("Name: ")[name]
name.case {
.ok name => console.print(name),
.err! => {},
}
console.close