1.8 KiB
1.8 KiB
Basics in Xircon's Lang (XILANG)
A short and relatively detailed list of all the basics of XILANG. Also yes, the name is supposed to be all caps always just like older FORTRAN.
Extremly Basic Functions
retthen a value (can be a numeral or a string) will return that valuefuncthen a name (ex:func main() {}) allows you to define a new functionimportand a filename (either in""or<>depending on if it is a local file in the dir or a file from the include path, similar to C) allows you to import the functions from another file (ex:import Example.xh)printthen a value will allow to print a character or string to the screen (you can also print any other type of varible)
Defining Varibles
you define something by doing the type of var you want to define then a name then an = and the value of it (ex: float Example = 1.0;)
intwill allow you to define an integer value, just like in Cfloatfor a floating point valuebooleanfor a boolean value (true or false)stringfor a string value (the value MUST be wrapped in""s!)charfor a single character value (must be wrapped in''s!)
Ifs and Loops
ifis pretty simple its justif x = y {do this}loopis a bit more... dangerous. you can loop... well... basically forever if you were to... forget the value...loop 100 {print "This"}orloop {print "This"}are both valid ways to use loop, one does the same thing 100 times the other does it until your CPU stops CPUing.whiledoes something while something is true, for examplewhile x = 1 {print "This"}orwhile x > 1 {print "This"}
A Basic Program
A Basic program that just prints text and then returns.
string hi = "Hello";
func main() {
print hi," World!";
ret 0;
}
This small prgram will print Hello World! and return 0.