I am finding an unexpected token in the following code.
switch ( hobby ) {
case =" painting ":
message = "Van Gogh was good at that.";
break;
case =" drawing ":
message = "Hey! Van Gogh did that too.";
break;
case =" playing guitar ":
message = "Bob Dylan played guitar.";
break;
case =" sleeping in ":
message = "My favorite hobby in the winter.";
break;
default
}
Does anyone see what I am missing?
Your syntax is off. Remove the
=aftercases. Also, you’ll need to put a:afterdefault.See here for more about
switchstatements.