I am getting Missing Parameter on line 3 and
Syntax error on line 4
I have tried every combination of parenthesis and putting the variable name in the case statements. No joy.
Any ideas?
Code Sample:
Sub BehaviorCheck
Private D As Byte
Select Case D
Case < 6 'Passive
ActionTable2Modifier = ActionTable2Modifier - 2
Case < 11 'Moderate
'ActionTable2Modifier does Not change.
Case < 16 'Active
ActionTable2Modifier = ActionTable2Modifier + 2
Case > 15 'Agressive
ActionTable2Modifier = ActionTable2Modifier + 4
End Select
End Sub
Private D As Byte
Select True
Case D < 6 'Passive
' ActionTable2Modifier = ActionTable2Modifier - 2
Case D < 11 'Moderate
' 'ActionTable2Modifier does Not change.
Case D < 16 'Active
' ActionTable2Modifier = ActionTable2Modifier + 2
Case D > 15 'Agressive
' ActionTable2Modifier = ActionTable2Modifier + 4
Case Else
End Select
This doesn't fix the code.
Select Case is also acceptable while it is optional (mentioned in B4X Booklet) and it will be ignored.
One thing I suggest from the answer in post #2 is the last condition check (Case Else) and passing the value as parameter in function signature.
B4X:
Sub BehaviorCheck (D As Byte)
Select True
Case D < 6
Log("Passive")
Case D < 11
Log("Moderate")
Case D < 16
Log("Active")
Case Else ' D > 15
Log("Agressive")
End Select
End Sub