Bug? 'Then' Expected

yttrium

Active Member
Licensed User
Longtime User
Getting a weird false error when compiling.

B4X:
Parsing code.                          0.02
Compiling code.                        Error
Error compiling program.
Error description: 'Then' expected.
Occurred on line: 178
If 13 < Age =< 60 Then
Word: =

Suspected it was the = sign, perhaps B4A doesn't support that kind of comparison? So I tried that:

B4X:
Parsing code.                          0.02
Compiling code.                        Error
Error compiling program.
Error description: 'Then' expected.
Occurred on line: 178
If 13 < Age < 60 OR Age = 60 Then
Word: <

I also tried rewriting the entire line and segment, but still got the error.

The sub is as follows:


B4X:
Sub CalculateBtn_Click
   Dim Age As Int = DateUtils.PeriodBetweenInDays(DateTime.Date(DateTime.Now), BirthDate)
   If 13 < Age < 60 Then
   Else If (60 < Age < 150) OR (Age = 150) Then
   Else If (150 < Age < 180) OR (Age = 180) Then
   Else If 180 < Age Then
   End If
End Sub

Any ideas?
 

yttrium

Active Member
Licensed User
Longtime User
Can B4A really not do multiple comparisons? Damn.

That fixed it.
 

yttrium

Active Member
Licensed User
Longtime User
As far as I know, VB.NET supported it.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…