Switch Statement

I decided to create a switch statement on Snap! Download Block

untitled script pic (1)

var i = "a";
switch (i) {
	case "a":
    case "b":
    	return "A";
    case "c":
    case "d":
    	return "C";
    case "e":
    case "f":
    	return "E";
    default:
    	return "-";
}

btw, it's better if you just share a project with it in it, that way the user can test out the block without downloading it.

Cool! I love making control structures in Snap!.

I'm grinning about how in the equivalent code in JS or Python or whatever that is, you felt the need to put break statements after the return statements. Force of habit?

Unreachable break after return statement

Oh, I forgot about that.

:slight_smile: I'm litarally saying the same thing as

Is there an alternative to this? The download link no longer works.

Try this library