JavaScript
x
6
1
x=1
2
if display == old_display:
3
x=x+1
4
print(x)
5
print(stages[7-x])
6
I need the value of x
to increase by 1 when the condition display == old display is true
I tried to set the condition with if statement and when it is true i need x to decrease by 1. This is a part of hang man game and this part of code is to display the hang man structure when choosing wrong letter.
Advertisement
Answer
JavaScript
1
3
1
if display == old_display:
2
x -=1
3
this snippet decreases x
by 1 every time display == old_display