Wish Undeclared in Select Case statement

Scantech

Well-Known Member
Licensed User
Longtime User
Check the code below. B4A does not catch "Undeclared Variable" in Case 1. More room for improvements?

B4X:
    Dim x As Int
    Select Case x   
        Case 0
            Dim l As List
            l.Initialize
            l.Add("0")
        Case 1
            l.Add(1)
           
    End Select
 

Scantech

Well-Known Member
Licensed User
Longtime User

B4A can catch some of it. The following sample below will show "Undeclared Variable" for "l.initialize" in the log.

B4X:
    Dim x As Int
  
    Select x
        Case 0
            l.Initialize          
    End Select
 

ilan

Expert
Licensed User
Longtime User
or do you mean the right top logs just to inform you that there is an error before a compile?
 

Scantech

Well-Known Member
Licensed User
Longtime User
or do you mean the right top logs just to inform you that there is an error before a compile?
Yes, the Top Right Log.

My first post codes will compile successfully and cause an error when case 1 is triggered.
 

ilan

Expert
Licensed User
Longtime User
Yes, the Top Right Log.

My first post codes will compile successfully and cause an error when case 1 is triggered.

sorry, i misunderstood you. you are right about that. catching an error while coding is very important.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…