#Can someone check if this is correct?

7 messages · Page 1 of 1 (latest)

finite girder
#

Is this accurate?

if (y >= 8 && y < 16) {
    y -= 8;
    x += 128;
    if (!(x >= 129 && x <= 257)) {
        x = -1;
    }
}

This code block performs the same transformation of the x and y coordinates as the original code block, but uses a different syntax to check the bounds of the x variable.

Note that in this case, I used the negation of &&, which is ! (logical NOT), to combine the two inequality expressions for x. Using ! before an expression inverts its logical value, so the condition C !(x >= 129 && x <= 257)
is equivalent to

x < 129 || x > 257.
dire heronBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

snow mantle
#

yes

heady wyvern
#

duplicate question

#

!quote #c-help-text message

dire heronBOT
#
dgh

Is this accurate?

if (y >= 8 && y < 16) {
    y -= 8;
    x += 128;
    if (!(x >= 129 && x <= 257)) {
        x = -1;
    }
}

This code block performs the same transformation of the x and y coordinates as the original code block, but uses a different syntax to check the bounds of the x variable.

Note that in this case, I used the negation of &&, which is ! (logical NOT), to combine the two inequality expressions for x. Using ! before an expression inverts its logical value, so the condition C !(x >= 129 && x <= 257)
is equivalent to

x < 129 || x > 257.

From #c-help-text [[Jump to message]](#c-help-text message)

heady wyvern
#

!solved