[Gambas-user] File opening dialog and one more question

Dmitrij Malkov dima.malkov.russia at ...626...
Fri Jan 6 17:04:21 CET 2012




Willy Raets wrote:
> 
> On vr, 2012-01-06 at 07:33 -0800, Dmitrij Malkov wrote:
> 
>> I wondered that the code
>> -------------------------------------------
>> Public Sub Main()
>>    CUnit.HowManyUnits()
>> End
>> -------------------------------------------
>> works, but the code
>> -------------------------------------------
>> Public Sub Main()
>>    CUnit.HowManyUnits()
>>    Dim Unit1 As New CUnit 
>> End
>> -------------------------------------------
>> does not ("Dim is unexpected"). I awaited a message like "CUnit is not an
>> object" in a worst time. You answered, that gambas syntax doesn't allow
>> it.
>> But in the documentation the next only is written: "All DIM declarations
>> must be in the FUNCTION or SUB before the first executable command." I
>> don't
>> see that I have breaked this.
> 
> 
> Well you have broken that.
> Afther Public Sub or Function Dim comes first.
> In your code Dim comes second
> 
> Try:
> 
> Public Sub Main()
>      Dim Unit1 As New CUnit 
>      CUnit.HowManyUnits()
> End
> 
> Willy
> 

So easy? Ok. But why the code

 Public Sub Main()
    CUnit.HowManyUnits()
 End

works correct without any DIM at all? If Benoit will say, that this code
works and that code doesn't because just gambas syntax allows this and
deprecates that and my brain is small to understand these simple things, so,
I will calm down.
-- 
View this message in context: http://old.nabble.com/File-opening-dialog-and-one-more-question-tp33085420p33093901.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list