# loop

## Recommended Posts

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

kind regards

##### Share on other sites

```\$x = 100
for \$i=1 to 10
\$x = \$x * 1.2
send (\$x)
Next```

##### Share on other sites

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 on other sites

Sorry meant to ...

```\$x = 100
sleep(2000)

For \$i = 1 to 10
send(\$x*1.2&@CRLF)
\$x = \$x * 1.2
Next```
##### Share on other sites

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

##### Share on other sites

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 on other sites

boogieoompa :

yes its rounding problem results are:

120

144

1728

20736

248832

is it possible to solve it; I apriciate your help

##### Share on other sites

```\$x = 100
for \$i=1 to 10
\$x = Round(\$x * 1.2, 0)
send (\$x)
Next```

Edited by Zedna
##### Share on other sites

Solved

thaks boogieoompa

thanks Zedna

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...