Help wanted for Conditionals 3 Test your skills

Hey guys, I’m not quite sure what I’m doing wrong here with this third exercise. I keep getting SyntaxError: Unexpected token ‘else’ but I just can’t see what’s wrong with it, so another pair of eyes would be super helpful!

Here’s my code:

let response;
let score = 75;
let machineActive = true;

if(machineActive) {
	// Add your code here
switch (true) {
case (score < 0 || score > 100):
response = 'This is not possible, an error has occurred';
case (score < 20):
response = 'That was a terrible score. Total fail!';
case (score < 40):
response = 'Pretty bad needs improvement';
case (score < 70):
response = 'Passable';
case (score < 90):
response = 'Great';
case (score <= 100):
response = 'Best';
} else {
  response = 'The machine is turned off. Turn it on to process your score.';

// Don't edit the code below here!

section.innerHTML = ' ';
let para1 = document.createElement('p');
let para2 = document.createElement('p');

para1.textContent = `Your score is ${ score }.`;
para2.textContent = response;


Thanks in advance for any help!

Hi @charlo and welcome to the community :wave:

Look at the closing square bracket before the else and ask yourself: “Which is the corresponding opening square bracket?” It’s not the one you’re thinking it is. Indenting the code will help with such problems.

Solution The closing bracket is for the switch statement. Add another one there to also close the if block before the else keyword.

Feel free to ask if my explanation isn’t clear. :slightly_smiling_face:

Happy coding,