Jump to content
Sign in to follow this  
majed

loop

Recommended Posts

majed

hi

I want a loop to do the following:

x=100; start point first result of the loop

100*1.2=120; is the second result of the loop

120*1.2=144; is the 3ed result of the loop

144*1.2=173; is the 4th result of the loop

....

etc

I tryed to solve it like this

for $i=1 to 10

send (x*1.2)

next

it dosnt work; please help

kind regards

Share this post


Link to post
Share on other sites
boogieoompa

This should work, just enter the code and you have 2 seconds to get to notepad or what have you before it begins. Think this is what you were talking about.

$x = 1
sleep(2000)

For $i = 1 to 10
send($x*1.2&@CRLF)
$x = $x+1
Next

Share this post


Link to post
Share on other sites
boogieoompa

Sorry meant to ...

$x = 100
sleep(2000)

For $i = 1 to 10 
send($x*1.2&@CRLF)
$x = $x * 1.2
Next

Share this post


Link to post
Share on other sites
majed

sorry the first 3 numbers are O.K then its not; some thing is missing (thanks)

Share this post


Link to post
Share on other sites
boogieoompa

I have it working fine, however it is not rounding for instance on your sheet you have the 4th iteration as 173 but 144 x 1.2 = 172.8. The script just deals with exact numbers so every iteration will give you an additional decimal place.

Share this post


Link to post
Share on other sites
majed

boogieoompa :

yes its rounding problem results are:

120

144

1728

20736

248832

is it possible to solve it; I apriciate your help

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.