I have a global and local variable with the same name. If I change the local variable, it overrides the global one. Example below. Demo is also attached.
This is not how it works in other languages. A local variable will never override a global variable.
Bug or "feature"?
This is not how it works in other languages. A local variable will never override a global variable.
Bug or "feature"?
Local variable overrides global:
Sub Globals
Private myvar As String = "Global"
Private EditText1 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
EditText1.Text = "Local"
End Sub
Sub Button1_Click
Private myvar As String = EditText1.Text ' Shouldn't override global myvar!
ToastMessageShow ("Local variable myvar set to '" & myvar & "'", True)
End Sub
Sub Button2_Click
MsgboxAsync (myvar, "Showing global myvar")
End Sub
Attachments
Last edited: