Hi was wonderring about the syntax for the following peice of code:
while [[ $life != 0 || $mask != $word ]] ; do
This is apparently incorrect. I want the loop to continue WHILE $life is not equal to zero or $mask is not equal to $word. Should ONE of these conditions fail to be met, loop should break out. Any ideas?
thanks in advance: Sant
looking at a bigger picture, if the programming language one is using doesn't "enforce" that, it doesn't really matter if one follows the "good" programming practice or not.
I'm not so sure about this claim. There is still a single exit at the bottom of the while, and how you get there seems to be the issue here. I would take the meaning of multiple-exit to be that there would be a place to which control is transferred without explicitly traveling through the end of the while, just as multiple-entry would mean entering the body of the while without going through the top of the while. (For precision I suppose we could say the statement immediately after the end of the while instead of the end of the while itself.)
In any case, I tend to lean toward making understanding and maintenance easy, so readability counts for a lot:
I enjoy these Dharma-duels (as long as they don't get out of hand, and I think I will be a grasshopper for long time) ... cheers, drl
I figure your right on... fix what you were doing wrong in the loop and learn something rather than jump ship... I was stuck in the same loop problem and your post helped me. its been years since I wrote anything and forgot how the || was evaluated.. as soon as I read your post it all came back .. Thanks...