Ruud H.G. van Tol on Wed, 12 Jan 2022 04:14:56 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

forbidden comparison



I expected this to just work:

my(v=23, c3=7); while( my(c=c3*2); c < v, c3=c ); print([v,c3]);


Now changed it to;

my(v=23, c3=7);while( c3*2 < v, c3*=2 ); print([v,c3]);
[23, 14]


With 'if', this works:

? my(v=23, c3=7); if(my(c=c3*2)*0+c, print(c))
14

but while has an extra scope?

-- Ruud

? print(my(c=25))
0

? print(my(c=25)*0+c)
25