PDA

View Full Version : 7 lines of code i can't find the error, plz help


Sensation
11-16-2007, 07:19 PM
if(vposition == -1)count = count +1
if (count = 10)alert("you have lost, sorry");
if(vposition == 0)c1 = c1 +1
if(vposition == 1)c2 = c2 +1
if(vposition == 2)c3 = c3 +1
if(vposition == 3)c4 = c4 +1
if (c1 = 1 && c2 =1 && c3 = 1 && c4 = 1)alert("you have won, congratz!");

liorean
11-16-2007, 07:31 PM
if(vposition == -1)count = count +1
if (count = 10)alert("you have lost, sorry");
if(vposition == 0)c1 = c1 +1
if(vposition == 1)c2 = c2 +1
if(vposition == 2)c3 = c3 +1
if(vposition == 3)c4 = c4 +1
if (c1 = 1 && c2 =1 && c3 = 1 && c4 = 1)alert("you have won, congratz!");= --> == in the obvious spot, if your aim is that all of c1, c2, c3, c4 must contain a value of 1.

The intent and meaning of your code is far from clear in this snippet, however.

Sensation
11-16-2007, 07:33 PM
c1-c4 is count 1-4

its checking errors in my hangman program
4 correct you win
10 wrong you lose....

vposition is the location of the textbox and correct letter....

its still not working....

Philip M
11-16-2007, 07:39 PM
if(vposition == -1)count = count +1
if (count = 10)alert("you have lost, sorry");

How can count ever reach 10?

Sensation
11-16-2007, 07:42 PM
for every wrong letter they get vposition is -1

10 of those they loose the game

look at my other Thread

Html Doc Error
Sensation