Why does this condition cause error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does this condition cause error?

if (tossing()=1) {z++;}

19th Nov 2016, 7:37 PM
Maxikadze
2 Answers
+ 2
1. use == instead of = 2. make sure tossing is a numeric value-returning function
19th Nov 2016, 7:46 PM
Oluwatosin Akinbobuyi
Oluwatosin Akinbobuyi - avatar
+ 1
if(tossing()==) {z++} single '=' is for assignment use == for conditions
19th Nov 2016, 7:45 PM
Bahhaⵣ
Bahhaⵣ - avatar