====== Functions ====== Functions in **XC=BASIC** are procedures that return a value of a certain type. **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) ===== Calling overloaded functions ===== Some of the built-in functions are overloaded and thus they may return values of miscellaneous types. When calling a function, you must explicitly specify which type you wish to call by appending the right [[https://en.wikipedia.org/wiki/Sigil_(computer_programming)|sigil]] to the function name. For example, the [[ABS|ABS function]] can return an integer or a float: myInt = abs(-5) myFloat%= abs%(-3.14) Another example is [[RND|RND]] that can return three different types: myRandomByte! = rnd!() myRandomInt = rnd() myRandomFloat% = rnd%() Note: user defined functions may not be overloaded. ===== Defining user functions ===== Please refer to the [[fun|FUN ... ENDFUN]] directive for details.