# Stuck at step 7

#1

I'm not quite sure on how to make this work.. i am assuming that you can't place a second else if process if there is already one right above it?

function compare (choice1, choice2) {
if (choice1 === choice2) {
return "The result is a tie!";
}
else if (choice1 === "rock") {

``````    if (choice2 === "scissors") {
return "rock wins";
}
} else {
return "paper wins";
}
else if (choice1 === "paper") {

if (choice2 === "rock") {
return "paper wins";
}
} else {
return "scissors wins";
}``````

};

#2

I answered my own question, i built a second block and that seemed to have fixed the issue:

function compare (choice1, choice2) {
if (choice1 === choice2) {
return "The result is a tie!";
}
else if (choice1 === "rock") {

``````    if (choice2 === "scissors") {
return "rock wins";
}
} else {
return "paper wins";
}``````

};

function compare (choice1, choice2) {
if (choice1 === choice2) {
return "The result is a tie!";
}
else if (choice1 === "paper") {

``````    if (choice2 === "rock") {
return "paper wins";
}
} else {
return "scissors wins";
}``````

};

#3

No that is not the solution. Think about it if you build another compare function this one will overwrite the last and so you can only deal with 1 case.

The problem is this:

``````else if (choice1 === "rock") {
if (choice2 === "scissors") {
return "rock wins";
}
} else {
return "paper wins";
}``````

the else should belong to the if not to the else if.
Longer: by belonging to the else if the else finishes the conditions dealing with the whole rest so when another else (if) comes after this you get an error.