On Sat, 13 Aug 2016 09:02:28 -0500, Bill Woodger wrote:
>
>This can be rewritten as
>
>    while (true)
>        read value
>        if (value == sentinel) break;
>        process value
>
Yet I prefer expression-oriented languages that allow constructs such as:

while read value && [ value != sentinel ]; do
    process value
    done

But, yes, if the condition is a little more complicated, it's better to 
encapsulate
it in a function.  Legibility should be the deciding concern: which constructs
impels fewer saccades by the reader?

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to