[try Beta version]
Not logged in

 
Weird...

Pages: 12
Sep 25, 2016 at 8:26am
WheatFieldOnFire:
1
2
3
4
int var = 5;
if (var != 6){
    //statments to be executed
}
Sep 25, 2016 at 8:28am
Farshad Aroon:
I would disagree saying that you should learn C before C++. Learning C first can cause confusion and cause bad programming habits.
Sep 25, 2016 at 10:50am
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 Sep 25, 2016 at 10:55am
Topic archived. No new replies allowed.
Pages: 12