Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:38 02 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Guest Book : local variables

Author Message
crez

Senior Member

Joined: 24/10/2012
Location: Australia
Posts: 152
Posted: 11:40am 04 Jun 2021
Copy link to clipboard 
Print this post

running the following

Option explicit
Dim a As integer
s1
End

Sub s1
Local b As integer
s2
End Sub

Sub s2
Local c As integer
a=1
b=1
c=1
End Sub


gives the error 'b is not declared' at line 14.
because sub s2 is called from within s1, I was expecting b would be declared, in the same way that a is available in s1. Apparently not. If I declare b in sub s1 using the DIM command, it becomes available in sub s2 but also the main program, which is not what I desired.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024