Basic lang syntax

canalrun

Well-Known Member
Licensed User
Longtime User
Hello all,

I have been off doing other languages and I don't remember some of the syntax details in the Basic language.

For example if ((a < b) and (c < d)) …
Is it supposed to be "and" or "&" or "&&" or something else?

Or for a range in the Select/case …
Is it "case 1 to 5" or "case 1-5" or something else ?

Is there a manual, section, or webpage that goes through this stuff for B4A?
I have found the help viewer, but I can't seem to find this information in my searches.

Thanks,
Barry.
 

mjcoon

Well-Known Member
Licensed User
Is it "case 1 to 5" or "case 1-5"

"1-5" is indistinguishable from an arithmetic expression which evaluates to minus 4, so that would have been a Bad Choice!

And to include ranges like that would suggest an If statement rather than a Select...

Mike.
 

klaus

Expert
Licensed User
Longtime User
And to include ranges like that would suggest an If statement rather than a Select...
Sorry, I don't agree.
For example
B4X:
Select Case Value
Case 1 To 5, 7 To 9
Case 6
End select
does exist in VB, and I used it quite often.
I was missing it too, but adapted my code to the B4PPC and B4A requirements.

Attention: in B4A it's Select Value unlike Select Case Value in VB.

Attention: This thread has been moved to Basic4Android !


Best regards.
 
Last edited:

canalrun

Well-Known Member
Licensed User
Longtime User
Thanks.
And thanks for moving the thread.
I had already posted when I noticed it was in the wrong place.

I agree, a range is handy to have in a Case statement.
But, it is easy to get around it by using an If.

Barry.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…