Functions

XC=BASIC offers several built-in functions. In addition, you can use the USR() function to call your own machine language function.

Return type

Some functions may return miscellaneous types and you have to explicitly tell the compiler which type you require. Just like with variables, the return type of a function is denoted with a sigil. For example, the ABS function can return an integer or a float:

myInt = abs(-5)
myFloat%= abs%(-3.14)

Another example is RND that can return three types:

myRandomByte!  = rnd!()
myRandomInt    = rnd()
myRandomFloat% = rnd%()