Sign in to follow this  
Followers 0
Hawkwing

changing a variable with a for loop

10 posts in this topic

#1 ·  Posted (edited)

If I wanted to have a for loop like so:

for $i = $x to $y
next

and I wanted $x always be equal to $i, would I have to add $x = $i or would this work?

$i = $x
for $i = $i to $y
next
Edited by Hawkwing

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites



If I wanted to have a for loop like so:

for $i = $x to $y
next

and I wanted $x always be equal to $i, would I have to add $x = $i or would this work?

$i = $x
for $i = $i to $y
next

What do you want to do

Write the full code of the process

that you want to do :D


صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

Well, I'm not actually writing a code. I don't have access to a computer with autoit right now, and I was just wondering if there was some sort of ByRef thing for a for loop.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

If you want $x always be equal to $i then you'll have to write it as:

$x=0
$y=10
for $i=$x to $y
 $x=$i
 MsgBox(4096,"",$x&"  "&$i)
 Next

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

$y=10

For $x=$0 to $y

MsgBox(4096,"",$x&","&$i)

Next

Why dont just use code like this?


[size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size]

Share this post


Link to post
Share on other sites

$y=10

For $x=$0 to $y

MsgBox(4096,"",$x&","&$i)

Next

Why dont just use code like this?

Because coding like that makes your app crash on a undefined variable error.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

$y=10

For $x=$0 to $y

MsgBox(4096,"",$x&","&$i)

Next

Why dont just use code like this?

What's $0, my friend?? And where did $i come from suddenly in Msgbox?

Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0