Can't get this switch / case sketch to work. Any ideas?

You can't define a variable inside a switch statement. Define that int outside first and then assign it a value inside the switch.

Actually, you can, if the variable is defined in a block. That is why each case starts and ends with { and },