Warning
You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
functions [2019/12/09 20:45] – [Functions] neils | functions [2019/12/12 19:35] (current) – [Functions] neils | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Functions ====== | ====== Functions ====== | ||
- | **XC=BASIC** | + | Functions in **XC=BASIC** |
- | | + | **XC=BASIC** supports: |
- | | + | |
+ | * Several built-in functions | ||
+ | * The [[USR|USR() function]] to call a machine language function | ||
+ | * [[fun|User-defined functions]] (since version 2.2) | ||
- | ===== Return type ===== | ||
- | Some functions may return miscellaneous types and you have to explicitly | + | ===== Calling overloaded functions ===== |
+ | |||
+ | Some of the built-in | ||
myInt = abs(-5) | myInt = abs(-5) | ||
myFloat%= abs%(-3.14) | myFloat%= abs%(-3.14) | ||
- | Another example is [[RND|RND]] that can return three types: | + | Another example is [[RND|RND]] that can return three different |
myRandomByte! | myRandomByte! | ||
myRandomInt | myRandomInt | ||
myRandomFloat% = rnd%() | myRandomFloat% = rnd%() | ||
+ | | ||
+ | Note: user defined functions may not be overloaded. | ||
+ | ===== Defining user functions ===== | ||
+ | |||
+ | Please refer to the [[fun|FUN ... ENDFUN]] directive for details. |