loveau Posted October 23, 2006 Posted October 23, 2006 variable's scope of for...next loop I write some code like: first: For $i =1 To 2 Step 1 For $i =6 To 7 Step 1 MsgBox(0,"in",$i) Next MsgBox(0,"out",$i) Next oÝ÷ ÚØ^ë.جÖ) the result is: 1 in=6 2 in=7 3 out=1 4 in=6 5 in=7 6 out=2 It' done! but most program language can write code like the first.
smashly Posted October 23, 2006 Posted October 23, 2006 Only 3 hours .. Dang your doing well compared to my learning curve
Valik Posted October 23, 2006 Posted October 23, 2006 variable's scope of for...next loop<snip>but most program language can write code like the first.Okay, what's your point? AutoIt obviously can't. Scope is at the function level or the global level. Loops do not have their own scope.
PaulIA Posted October 23, 2006 Posted October 23, 2006 For $i =1 To 2 Step 1 For $i =6 To 7 Step 1 MsgBox(0,"in",$i) Next MsgBox(0,"out",$i) Next This is not good programming practice in any language, regardless of scope issues. Your code makes it impossible to reference the outer loop variable from the inner loop, which is a common need in most nested loop structures. Auto3Lib: A library of over 1200 functions for AutoIt
loveau Posted October 23, 2006 Author Posted October 23, 2006 (edited) to Valik, PaulIA Thanks! I see! AutoIt is a great, and powerful scripting language! Edited October 23, 2006 by loveau
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now