Jump to content

Recommended Posts

Posted

How do you make it so that you can use the variables and their values that were declared in a func outside of that function?

  • Moderators
Posted (edited)

Yes, otherwise, local is assumed. I think.

Local is only assumed if the variable is declared within a function (or used in a For/Next eg. For $i where $i would be declared local unless otherwise stated previously, if declared this way, it will be destroyed like a Local variable after the For/Next loop expires).

Example of standard global distinction:

$s_example1 = "apple"
_badwaytodoit()

Func _badwaytodoit()
    MsgBox(64, "$s_example1", $s_example1)
EndFuncoÝ÷ ØÚ-uç%j¸§*.®ö«¦å{ûr¥ë"²Ø^²Ö«¶ÛiØZn+l~ߺ۫yÊx×¾ìb·öYl¢å¢Ç¬×¨Z·*.Á©í¶Þj  hm©oj¸nW¨­©hq©oj¸nW¢g­)à¶­¬ zܨº)íèZn+h}תâazgâ®Ëp¢é]mëh¦ëZºÚ"µÍÜ
    ][ÝÓ]ÝXÛUÉ][ÝËJ
At the top of your scripts. Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Okay that worked thanks. I learned autoit through playing around with it but right now I am in C++ classes and I will probably get in the habit of declaring variable types from now on.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...