Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

This is an old revision of the document!


Functions

XC=BASIC offers several built-in functions. In addition:

  1. you can use the USR() function to call your own machine language function
  2. since version 2.2, you can write user-defined functions

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%()