Silverfrost Forums

Welcome to our forums

winio inside a do loop is different to separate calls to wi

28 Feb 2016 2:39 #17256

Hello, I observe an unexpected result from a call to winio@ inside a do loop.

Here the loop: do nr = 1,2 ians = winio@ ('%2nl %`2rd %18rs &', nr, 'ABC') enddo The result shows two lines, each beginning with '3' instead of '1' and '2'

Here the two lines which produce the desired result: nr=1; ians = winio@ ('%2nl %2rd %18rs &', nr, 'ABC') nr=2; ians = winio@ ('%2nl %2rd %18rs &', nr, 'ABC')

Why that ?

Thanks in advance Wolf

29 Feb 2016 7:53 #17258

winio@ passes the address of nr and not its value. So you should get the current value of nr whatever it is.

29 Feb 2016 10:19 #17259

I couldn't get 1 & 2 from the non-DO loop code, I got 2 twice. This accords with Paul's reply.

I suggest using different array elements for the variable, so instead of nr, integer_variable(nr).

29 Feb 2016 5:33 #17260

Thanks gentlemen,

I like the suggestion to pass an array element to winio@ instead of a single variable. I works fine and code looks much nicer than 12 individual winio@ lines.

Please login to reply.