Nested IF - THEN - ELSE
Posted: Fri Jul 29, 2016 3:43 pm
OK guys, I am still trying to learn this interpreter and I am still not getting the basics which is frustrating cuz I have been coding for a LONG time - just in another basic which was compiled (Picbasic Pro).
I am having trouble with the following code. It errors saying:
Else Without IF line 65535
End if Without IF line 97
Else Without IF line 65535
End if Without IF line 102
Else Without IF line 65535
End if Without IF line 107
End if Without IF line 112
If Without Endif line 117 0
And the code section is below:
I am just trying to move a selection from several (4) radio buttons.
If you push UP button it will cycle through the radio buttons and should show that the one you are currently on is selected by having its center filled in.
I don't see where I have failed to end an IF statement with an ENDIF except for:
if Selected = 4 then Selected = 0
which should be legal - shouldn't it???
I am having trouble with the following code. It errors saying:
Else Without IF line 65535
End if Without IF line 97
Else Without IF line 65535
End if Without IF line 102
Else Without IF line 65535
End if Without IF line 107
End if Without IF line 112
If Without Endif line 117 0
And the code section is below:
Code: Select all
[Menu.Up]
if io(laststat,UP) = 0 then
Selected = Selected + 1
if Selected = 4 then Selected = 0
If Selected = 0 then
rad1sel = 1
else
rad1sel = 0
endif
If Selected = 1 then
rad2sel = 1
else
rad2sel = 0
endif'Line 97
If Selected = 2 then
rad3sel = 1
else
rad3sel = 0
endif'Line 102
If Selected = 3 then
rad4sel = 1
else
rad4sel = 0
endif'Line 107
rad1 = tft.obj.radio(" Option One", 10,180,20,rad1sel,2,tft.rgb(255,0,0)) 'Example of a radio button
rad2 = tft.obj.radio(" Option Two", 10,210,20,rad2sel,2,tft.rgb(255,0,0)) 'Example of a radio button
rad3 = tft.obj.radio(" Option Three", 10,240,20,rad3sel,2,tft.rgb(255,0,0)) 'Example of a radio button
rad4 = tft.obj.radio(" Option Four", 10,270,20,rad4sel,2,tft.rgb(255,0,0)) 'Example of a radio button
endif'Line 112
wait'don't know why I need these but it works
return
I am just trying to move a selection from several (4) radio buttons.
If you push UP button it will cycle through the radio buttons and should show that the one you are currently on is selected by having its center filled in.
I don't see where I have failed to end an IF statement with an ENDIF except for:
if Selected = 4 then Selected = 0
which should be legal - shouldn't it???