Hello, this works: A1=3D1 A2=3D2 A3=3D3 i=3D1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari do for [i=3D1:3]{ vari=3Dsprintf("A%.f",i) print vari } But I want to have "print vari,"=3D",@vari" in the loop. But it dosen't=20 work. Why can't I use "print vari,"=3D",@vari" in the loop? Is there a=20 solution for? J=C3=B6rg
![]() |
0 |
![]() |
Jörg Buchholz wrote: > Hello, > > this works: > > A1=1 > A2=2 > A3=3 > > i=1 > vari=sprintf("A%.f",i) > print vari,"=",@vari > i=i+1 > vari=sprintf("A%.f",i) > print vari,"=",@vari > i=i+1 > vari=sprintf("A%.f",i) > print vari,"=",@vari > > do for [i=1:3]{ > vari=sprintf("A%.f",i) > print vari > } > > But I want to have "print vari,"=",@vari" in the loop. But it dosen't > work. Why can't I use "print vari,"=",@vari" in the loop? The @ indicates macro expansion, which only happens once. And that one time is before the loop is executed. So whatever value @vari has at the start of loop execution, that is the value it will have every time through. > Is there a solution for? You don't need macros for this do for [i=1:3] { vari = <whatever> print vari, ' = ', value(vari) } > Jörg
![]() |
0 |
![]() |
On 03.02.2016 01:05, Ethan A Merritt wrote: > You don't need macros for this > > do for [i=1:3] { > vari = <whatever> > print vari, ' = ', value(vari) > } Thanks a lot Ethan, with the keyword "value" I also found the relevant side in the manuel. Jörg
![]() |
0 |
![]() |