B4R Question Select fails after updating the Arduino esp32 board to v3

RJB

Active Member
Licensed User
Longtime User
Code like the following was working prior to updating the esp32 board to v3.0.1 in the Arduino board manager:
(see https://www.b4x.com/android/forum/t...h-arduino-esp32-board-v3-0-1-selected.161681/)
B4X: Copy
Public Sub Test(A As Int)
    Dim B As Int = 1
    Dim C As Int = 2
    Select A
        Case B    '1
        Case C    '2
        Case (B + C)    '3 - CAUSES ERRORS IN COMPILATION
        Case Else
    End Select
End Sub
It now fails.
It does work if the line 'Case (B + C)' if changed to 'case 3'
I don't know if that is to be expected or it's a bug?
There is no warning or error shown before compilation.
 
Why don't you set D=B+C and use a "Case D"?
 
  • Like
Reactions: RJB
Upvote 0
Why don't you set D=B+C and use a "Case D"?
Thanks.
Yes, if fact that is what I have done.
I was just interested in why it had changed and whether it is now working as it should or if it should be as it was!
Actual declaration is:
B4X: Copy
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.

.....
    Public TouchInputs As Int = 1
    Public SwitchInputs As Int = 2
    Public TouchAndSwitchInputs As Int = TouchInputs + SwitchInputs
.....
End sub
Thanks
 
Upvote 0
Back
Top