Weird...

Pages: 12
WheatFieldOnFire:
1
2
3
4
int var = 5;
if (var != 6){
    //statments to be executed
}
Farshad Aroon:
I would disagree saying that you should learn C before C++. Learning C first can cause confusion and cause bad programming habits.
1
2
3
if (something !== 5||2||6){
balah blah blah
}


There are three errors there.
1. the operator !== should be !=

2. each condition must be typed in full,
1
2
3
something != 5
something != 2
something != 6

3. when combining multiple conditions, take care choosing whether you need to use logical OR || or AND &&. In this case you need AND.

1
2
3
if (something != 5 && something != 2 && something != 6) {
    blah blah blah
}

Last edited on
Topic archived. No new replies allowed.
Pages: 12