in reply to exiting a if loop

hows about:
$check = TRUE if ((HOLIDAY) || ($time <= 1800));
or
((HOLIDAY) || ($time <= 1800)) ? $check = TRUE : $check = FALSE;
;)

Replies are listed 'Best First'.
RE: Re: exiting a if loop
by turnstep (Parson) on Jun 06, 2000 at 21:50 UTC

    Ah! A foul use of the beloved ternary test! 1 Don't put the lvalue in their twice. Do this instead: 2

    $check = $HOLIDAY || $time<=1800 ? "TRUE" : "FALSE";

    [1] TIMTOWTDI, of course, I'm not saying it's "wrong", just inelegant :)

    [2] Note that the use of "or" instead of "||" would be wrong in this case, as ternary is higher than "or", but lower than "||", in precedence.

      I concede that I did not make the best use of the ternary operator. oh well. now I know better.
      thanks for the tip Turnstep.