Imagine that for any reason I have a string that is a number followed by an undetermined number of characters, and I want to get that number for operations. I was trying something like
%a=1230abcd;
for (;%a/1==0;) {%a=%[%a,%[%a]];};
That's because %a/1 returns cero while %a is not numeric, and inside the 'for' I remove the last character in every loop.
But this doesn't work, and I don't know why. But that logical condition works fine inside an 'if', so this alternative works fine:
%a=1230abcd;
ii=0;
for(;ii==0;) {
if (%a/1==0) {%a=%[%a,%[%a]];}
else ii=1;
}
Do you know why does that work in an 'if' but not in a 'for'?
- Jose Via
Origin WebRing member
Edited by - Jose on 03/22/2002 12:10:10