Last active
June 29, 2019 04:08
-
-
Save Ratstail91/a189a7be88aee1a2124582671cefe732 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#comments begin with a pound sign | |
#The script automatically calls the function "main" after loading it | |
#this is how you declare a function called "main" | |
START main: | |
#do stuff | |
END #all functions finish with END | |
#this is how you write a function with arguments | |
START func a b: | |
#do stuff | |
RETURN 'hello world' #this is how you return a value | |
END | |
SET a = CALL func #this is how you set a variable from a function | |
#this is how you call a function (wrong number of arguments is a syntax error) | |
CALL func a b | |
#set a variable (strongly typed, 0 and FALSE are falsy, everything else is truthy) | |
SET number = 42 #optional trailing decimals | |
SET string = 'hello world' | |
SET boolean = TRUE | |
SET boolean = FALSE | |
#print to the console for debugging | |
PRINT string | |
PRINT 'hello world' | |
#conditionals | |
IF condition THEN: | |
#do stuff | |
ELSE IF condition THEN: | |
#do stuff | |
ELSE: | |
#do stuff | |
ENDIF | |
#while loops | |
WHILE condition THEN: | |
#do stuff | |
ENDWHILE | |
#conditionals | |
IF a EQUALS b THEN: | |
IF NOT a EQUALS b THEN: #not negates any conditional | |
IF a LTHAN b THEN: | |
IF a GTHAN b THEN: | |
IF a LTHAN EQUALS b THEN: | |
IF a GTHAN EQUALS b THEN: | |
#This is invalid; no AND and OR keywords: IF a AND b THEN: | |
#This is invalid; no AND and OR keywords: IF a OR b THEN: | |
#This is invalid; you can't nest conditionals: IF a LTHAN b AND c LTHAN d THEN: | |
#if every line was executed one-gamestep-at-a-time, then this could be possible | |
BRANCH func a b #fork the process, calling the function func with a and b as parameters; all globals are shared, never returns | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment