[Gambas-user] Function doing unexpected things...

sbungay sbungay at ...981...
Thu Jul 20 22:09:08 CEST 2006


   Going to take me a few minutes... it's on another machine...
   I can tell you that it is V1.9.34... source code to follow....

Benoit Minisini wrote:
> On Thursday 20 July 2006 04:34, sbungay wrote:
> 
>>    How to explain this without writing tons of code... hmmmmm.. here goes.
>>   I have a class which contains 3 public variables of type float.
>>   The class gets instantiated.
>>   One of the items within the class is named "subtotal" and it's value
>>is derived by summing up the items in one column of a grid. To do this I
>>wanted to use a function which returned type Float. So (keeping code
>>here to a minimum) the whole mess looks kind of like this...
>>
>>ClassName.SubTotal = ComputeSubTotal(GridName,GridName.Column)
>>
>>Private Function ComputeSubTotal (SourceGrid AS GridView, Col as
>>Integer) AS Float
>>Dim SubTotal AS Float
>>.
>>.
>>.
>>Logic to sum the column into "SubTotal" goes here
>>.
>>.
>>.
>>Return SubTotal
>>End
>>
>>   Gives me the error
>>
>>"Expected Float, got Function"
>>
>>   I expected the assignment to take the return value of the function
>>not the function itself... is this a bug or am I doing something wrong?
>>I can work around it using a SUB but IMHO it is more elegant to use a
>>function.
>>
>>P.S.
>>   Haven't used GAMBAS for over a year, just downloaded the latest
>>version and compiled it... it's looking very good Benoit. I like the new
>>editor.
>>
> 
> 
> It seems to be a bug. I need the version of Gambas you use, and the complete 
> source code of the module/class where the function is located.
> 
> Regards,
> 




More information about the User mailing list