[Gambas-user] (no subject)

Doriano Blengino doriano.blengino at ...1909...
Wed Apr 1 10:50:35 CEST 2009


Charlie Reinl ha scritto:
> Am Dienstag, den 31.03.2009, 22:23 +0200 schrieb Doriano Blengino:
>   
>> Charlie Reinl ha scritto:
>>     
>>> Salut, 
>>>
>>> you have to close 'If Then Else' by an 'Endif'
>>> Or you could write :
>>>
>>> If TextBox1.Text = "T" then TextBox2.Text = "T"
>>> If TextBox1.Text = "Y" then TextBox2.Text = "I"
>>>   
>>>       
>> If it is so, then the gambas parser has a problem:
>>
>>     if textbox1.text="0" then
>>       ' now a endif is expected...
>>     else    ' where does this "else" bind to?
>>
>> ...and the message "too many nested control structure" is completely 
>> misguiding.
>>
>> Regards,
>>
>>     
> Salut,
>
> you have to close 'If Then Else' by an 'Endif' .. I said!
>
> if textbox1.text="0" then
> 	' do something for "0"
> Else if textbox1.text="1" then 
> 	' do something for "1"
> Else
> 	' do something for all others (then "0" and "1")
> End if  '<---------------- close your control structure
>
>   
OK, found the problem.
Writing:

    if test then
    else if test then
    else if test then
    ...

works. Writing instead:

    if test then
    else
    if test then
    else
    ...

gives "Too many nested control structure", even if the ENDIF clause is 
present. For a few lines of code, it (correctly) says "ENDIF missing". 
Note that if you write 3 lines ending with THEN, then 3 ENDIF are 
required, so what you said before is wrong. And our friend is right, 
there is a limit; when the complex statement grows over a certain number 
of lines, the other error appears. I am too lazy to discover how many 
nested ELSEs are legal.

Regards,
Doriano






More information about the User mailing list