On 2008-11-13, jzakiya <[EMAIL PROTECTED]> wrote: > I'm translating a program in Python that has this IF Then chain > > > IF x1 < limit: --- do a --- > IF x2 < limit: --- do b --- > IF x3 < limit: --- do c --- > .----- > ------ > IF x10 < limt: --- do j --- > THEN > THEN > ----- > THEN > THEN > THEN
The placement of the THEN statements makes absolutely no sense in any language I've ever seen. > In other words, as long as 'xi' is less than 'limit' keep going > down the chain, and when 'xi' isn't less than 'limit' jump to end of > chain a continue. > > Is this the equivalence in Python? > > IF x1 < limit: > --- do a --- > elif x2 < limit: > --- do b --- > ---- > ---- > elif x10 < limit: > --- do j --- No. That's not the same at all. Here's one solution: while True: if x1 > limit: break do a if x2 > limit: break do b if x3 > limit: break do c ... if x10 > limit: break do j break -- Grant Edwards grante Yow! Eisenhower!! Your at mimeograph machine upsets visi.com my stomach!! -- http://mail.python.org/mailman/listinfo/python-list