4
Input Keyword
Maxwell edited this page 2026-01-22 21:26:42 +11:00

Keyword: input (or stdin)

Syntax: input &str

Time Complexity: N/A (depends on end-user)

Overview

The input keyword allows you to get user input via stdin. When this line is reached, the program will wait for the user to input text. After this, the argument variable is set to the inputted string.

Example Usage

We can make a simple truth machine by checking if the input is 0 or other.

input &str
equal $str "0" &cond # check if char is "0"
if $cond %outonce # if char is 0, jump to the bottom script
@loop # otherwise loop
    println $char # append char and \n to stdout
    jump %loop # loop forever
@outonce
println "0" # append "0\n" to stdout