+ 2

What's wrong? It keeps giving me errors?

double possibility; if(possiblity > 0 || possiblity = 0){ return "possible"; } else{ return "can't be done"; }

10th Mar 2018, 12:31 PM
Esraa A
Esraa A - avatar
4 Answers
+ 31
1. I think the "possibility" variable should be initialized. 2. Wrong condition. Must be like this: if(possiblity > 0 || possiblity == 0)
10th Mar 2018, 12:36 PM
Igor Makarsky
Igor Makarsky - avatar
+ 10
check assignment vs evaluating equality = vs ==
10th Mar 2018, 12:33 PM
Louis
Louis - avatar
+ 9
When checking for equals in an if statement, use ==, not =. double possibility; if(possiblity > 0 || possiblity == 0){ return "possible"; } else { return "can't be done"; }
10th Mar 2018, 12:39 PM
apex137
apex137 - avatar
+ 4
thanks I absolutely forgot
10th Mar 2018, 12:36 PM
Esraa A
Esraa A - avatar