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%()
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies

Discussion

Enter your comment. Wiki syntax is allowed:
J M L L H