Thanks for your explanations. This is all specific to SBASIC.
Tobias gives an example with a LOCal name the same as the function name.
Although this is possible, it cannot be recommended. You will not be able
to call the function recursively. And it won't compile with either QLiberator
On Thu, 10 Aug 2017 20:33:58, Tobias Fr?schle via Ql-Users
The type of a function is not determined by the function name ending in a $ or
% sign, but rather by what it returns - You can even write a function STRING%
that returns a string or a function a$ that returns an integer value. The name
you give your function is simply a hint to yourselves on what it might return.
What you actually return in your original function is the result of an
/expression/ - and numerical expressions in S*BASIC are of type floating point.
If you assign the value to the expression to a LOCal integer value and return
that, you will actually get your desired result.
1000 DEFine FuNction x% (param)
1010 LOCal x%
1020 x% = param / 10
1025 REMark assign to integer variable x% to make sure INT is returned
1030 RETurn x%
1040 END DEFine x%
QL-Users Mailing List