2
User Input and Output
DiamondNether90 edited this page 2025-09-22 09:54:41 +10:00

In Ground, there are 3 commands that are used for I/O. These are stdin, stdout, and stdlnout.

Stdin

The stdin command allows user input within the terminal. It allows the user to input a value, and it will store the input in a variable.

The syntax is: stdin &variable.

Stdout

The stdout command allows the program to output text to the terminal.

The syntax is: stdout $string

Stdlnout

The stdlnout command allows the program to output text to the terminal. Unlike stdout, stdlnout will automatically append a newline character to the end of any string. Please note that this command is not yet functional in GroundPY - a workaround is to simply append a newline character to the end of the string.

The syntax is: stdlnout $string

Example Program

This program asks the user "Do you like cheese?" until the user inputs "yes" (must be lowercase).

@begin
stdout "Do you like cheese? "
stdin &userin
equal $userin "yes" &condition
if $condition %end
stdlnout "That is sad"
jump %begin
@end
stdlnout "Awesome! I do too!"

The program outputs "Do you like cheese? ", and waits for a reply. If the reply is "yes", it will jump to the end, outputting "Awesome! I do too!". Otherwise, it outputs "That is sad", and returns to the beginning.