If/else statement

when i have an if statement and no else at the end, the code i put after that can be considered the actual code to execute if the condition is false ?

if (pressCount == 3) {
        ReceivedData = true;
}
if (pressCount == 3) {
        ReceivedData = true;
}some code after the if statement

Here is your example Auto formatted in the IDE

if (pressCount == 3)
{
  ReceivedData = true;
}
some code after the if statement

It should be obvious that the last line of code will be executed regardless of the result of the conditional code

Summary in answer to your question. No

Why not use an else ?

1 Like

because i only need to know if that variable is 3 else do nothing

It may be even more obvious when manually formatted thusly:

    if (pressCount == 3) {
        ReceivedData = true;
    }

    …some code after the if statement

Two statements. Both are executed.

a7

1 Like

So don't put any code after the code block if the if