May.25.2020 -- CAlive to introduce the !() negating logic operator

8 views
Skip to first unread message

Rick C. Hodgin

unread,
May 25, 2020, 10:20:58 PM5/25/20
to CAlive Programming Language
CAlive will introduce the !() syntax to negate logic tests for formal commands if and while.  This is the equivalent of doing a logic test and then branching on the opposite condition.

    // Traditional code, test the logic and negates the entire expression within the logic test
    if (!(a == b && c == d))
        // Code here

    // With the negating logic operator, you can code the original logic and invert it outside the logic test
    if !(a == b && c == d)
        // Code here

Note:  This is a sweeping negation.  It will invert the entire result of the logic test.

-- 
Rick C. Hodgin

Reply all
Reply to author
Forward
0 new messages