-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
- OUT function
- IN function
- VAR function
- Number functions
- RUN function
- EXT function
- IF function
- GO function
- Looping
- Example Code
The OUT function outputs data to the terminal
If the text is a variable name and is enclosed with {}, it will output the variable value instead
OUT value
OUT Hello World
OUT {variable}
Gets user input
This is useless unless it is saved to a variable or output
VAR input IN
OUT IN
This allows you to store values as variables
Number function results can be stored in the variables
VAR variable value
VAR c ADD a b
Constants are defined with an all caps variable name
They cannot be changed after they have been defined
VAR CONSTANT value
These are all useless unless saved to a variable or output
The ADD function adds two numbers
It can add a mixture of variables and numbers
OUT ADD value value
OUT ADD 1 2
OUT ADD variable 1
The SUB function subtracts two numbers
It can subtract a mixture of variables and numbers
OUT SUB value value
OUT SUB 1 2
OUT SUB variable 1
The MUL function multiplies two numbers
It can multiply a mixture of variables and numbers
OUT MUL value value
OUT MUL 1 2
OUT MUL variable 1
The DIV function divides two numbers
It can divide a mixture of variables and numbers
OUT DIV value value
OUT DIV 1 2
OUT DIV variable 1
The POW function returns a number to the power of another
It raises the first value to the power of the second
It can do this to a mixture of variables and numbers
OUT POW value value
OUT POW 1 2
OUT POW variable 1
The RAND function returns a random number between a certain range
It can do this with a mixture of variables and numbers
OUT RAND lower upper
OUT RAND 0 1
OUT RAND variable 1
The RUN function loads a file and runs the code inside it
RUN value
RUN program.txt
The EXT function exits the program
EXT
The IF function will only run the code that comes after it if the parameters are true
Other functions are included like AND, OR, NOT and EQL to allow you to run the IF function
AND, OR and NOT only take boolean values or variables with boolean values
EQL can take any value including variables
IF comparison_function value value code
IF comparison_function value code
This checks between two boolean values
IF AND value value code
IF AND true true OUT This code will run
This checks between two boolean values
IF OR value value code
IF OR true false OUT This code will run
This checks one boolean value
IF NOT value code
IF NOT false OUT This code will run
This checks if two values are equal
IF EQL value value code
IF EQL 1 1 OUT This code will run
This checks if the first value is greater than the second
IF GRT value value code
IF GRT 2 1 OUT This code will run
This checks if the first value is less than the second
IF LST value value code
IF LST 0 1 OUT This code will run
The GO function takes you back to a specific line number
GO value
GO 1
To loop you need to include an IF statement that continues and a GO statement to go back to the beginning of the loop.
OUT This will loop until you enter 10
VAR number IN
IF EQL number 10 GO 5
GO 2
OUT You entered 10
EXT
In this example, if the input equals 10, it skips forwards and ends the program
However, if this is not true, the program then goes back to the beginning of the loop
OUT ADD 1 2
VAR score 10
OUT {score}
OUT Hello World
OUT IN
VAR input IN
OUT Input the first number
VAR a IN
OUT Input the second number
VAR b IN
OUT Those values added together gives you
OUT ADD a b
OUT What is your first number?
VAR num1 IN
OUT What is your second number?
VAR num2 IN
OUT What mathematical symbol do you want to use?
VAR symb IN
IF EQL symb + OUT ADD num1 num2
IF EQL symb - OUT SUB num1 num2
IF EQL symb * OUT MUL num1 num2
IF EQL symb / OUT DIV num1 num2
IF EQL symb ^ OUT POW num1 num2
OUT \n
GO 1