Re: if statement not working
- Posted by petelomax at blueyonder.co.uk Mar 23, 2002
- 535 views
On Sat, 23 Mar 2002 01:28:21 -0800, David Cuny <dcuny at LANSET.COM> wrote: > >rforno wrote: > >> if s[1..2] = "/*" then ... >> could never work fine. It gives an error message telling conditions must be >> atoms. > >Yes, and that's perhaps the most suprising bit of all. You'd sort of expect >that with an emphasis on being orthagonal, the 'if' would accept {0, 0} as >false, and { 0, 1 } as true. > A slight typo there I think. Surely if s is "//" or "**" then the comparison would return {1,0} or {0,1} respectively. You meant {1,1}. If every element of a sequence is a +ve integer, if treats it as true. Question: what does this print? a={} if a then ?1 else ?0 end if Pete PS if Rob completely annihilates all index bounds checking, which I doubt, then fine, I have the source so I can put it back!