For loop allowed inside Select?

ncc1701mda

Member
Licensed User
Longtime User
I can't find any related posts here ... apologies if I've missed them...

I tried to create a for next loop inside a select end select block and it will not compile - here is some simple code that shows this:

Sub TestIt
Dim X2 As Int
Dim Y As Int

Y = 1

Select Y
Case 1

For X2 = 0 To 5

Next X2

Case 2

End Select

End Sub

Am I doing somthing wrong here or???

Mike
 

Ricky D

Well-Known Member
Licensed User
Longtime User
try this

B4X:
Sub TestIt
     Dim X2 As Int
     Dim Y As Int
 
    Y = 1
 
    Select Y
        Case 1 

            For X2 = 0 To 5

            Next

 Case 2
 
End Select
 
End Sub

The next statement doesn't need the loop variable.

This is what's causing the compiler to complain.

Hope this helps

regards, Ricky
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
not stupid!

:sign0105:

you're not stupid.

Too simple a thing for our complex brains I say!

I do understand this because I hit hit it too.

cheers, Ricky
 
Upvote 0
Top