diff --git a/Input-Keyword.md b/Input-Keyword.md new file mode 100644 index 0000000..2a81e18 --- /dev/null +++ b/Input-Keyword.md @@ -0,0 +1,21 @@ +Keyword: `input` (or `stdin`) + +Syntax: `input &str` + +Time Complexity: + +## 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](https://esolangs.org/wiki/Truth-machine) by checking if the input is 0 or other. +```grnd +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 to stdout + jump %loop # loop forever +@outonce +println "0" # append 0 to stdout +``` \ No newline at end of file