javascript - I'm new, and I cannot for the life of me find this syntax error -
i not understand why there syntax error in line 12, there seems one.
g = 0 y = 0 c = 0 while(true) { computer = random(3); = choose("choose!", "rock", "paper", "scissors"); if (computer == 1){ if (you == 2){ show("you win!"); g = g + 1; y = y + 1; if (g == 3) { break; show("computer: " + c + "you: " + y); } } else if (you == 1) { show("draw"); g = g + 1; if (g == 3) { break; show("computer: " + c + "you: " + y;) } } else if (you == 3) { show("computer wins."); g = g + 1; c = c + 1; if (g == 3) { break; show("computer: " + c + "you: " + y;) } }
}
y;)}
should y);}
in 2 places
another issue though, have break; show(...
in 3 places, show
don't think run after break
var g = 0, y = 0, c = 0; while (true) { computer = random(3); = choose("choose!", "rock", "paper", "scissors"); if (computer == 1) { if (you == 2) { show("you win!"); g = g + 1; y = y + 1; if (g == 3) { break; // <=== break here? show("computer: " + c + "you: " + y); } } else if (you == 1) { show("draw"); g = g + 1; if (g == 3) { break; // <=== break here? show("computer: " + c + "you: " + y;) // <=== don't wink here ;) } } else if (you == 3) { show("computer wins."); g = g + 1; c = c + 1; if (g == 3) { break; // <==== break here? show("computer: " + c + "you: " + y;) // <=== don't wink here ;) } } } }
p.s. use http://jsbeautifier.org/ beautify code before posting
Comments
Post a Comment