How to maake a function return an int

BlitzPlus Forums/BlitzPlus Programming/How to maake a function return an int

indietom(Posted 2014) [#1]
Hi!

I want to make a function that returns an int, I know how to make a function return true or false but not an int.

Thanks for any help


GfK(Posted 2014) [#2]
Functions return an Int by default.


Zethrax(Posted 2014) [#3]
I don't think BlitzPlus has a boolean data type so those true/false values you're getting are actually integer values.

Returning an integer from a function
Function MyFunction%()
   Local my_variable%
   my_variable% = 123
   Return my_variable%
End Function

Print MyFunction%()


Note that the % marker following the function name and variable name declare the function and variable to be of the integer data type. The data type marker only needs to be present when a function, variable, etc is first declared, and can be omitted after that. In the case of integers the data type marker is not needed as the integer data type is the default data type.

Available data types and their markers are:-
Integer - %
Float - #
String - $