exit status 1 break statement not within loop or switch

Hi, I got an error while compiling sketch and I don’t know how to fix it.

Can anyone help me

This is the code:-

#include <Mouse.h>
#include <Keyboard.h>

// set pin numbers for the five buttons:
const int SpaceButton = 2;
const int CButton = 3;
const int ZButton = 4;
const int ShiftButton = 5;
const int CtrlButton =6;
const int SevenButton =7;
const int EightButton =8;
const int NineButton =9;
int inChar;

void setup() { // initialize the buttons’ inputs:
pinMode(SpaceButton, INPUT);
pinMode(CButton, INPUT);
pinMode(ZButton, INPUT);
pinMode(ShiftButton, INPUT);
pinMode(CtrlButton, INPUT);

Serial.begin(9600);
// initialize mouse control:

Keyboard.begin();
}

void loop() {
// use serial input to control the mouse:
if (Serial.available() > 0)
char inChar = Serial.read();

if (Serial.available() > 0)
char inChar = Serial.read();

switch (inChar)
case ‘SpaceButton’:
// move mouse up
Mouse.move(0, -40);
break;
case ‘C’:
// move mouse down
Mouse.move(0, 40);
break;
case ‘Z’:
// move mouse left
Mouse.move(-40, 0);
break;
case ‘Shift’:
// move mouse right
Mouse.move(40, 0);
break;
case ‘Ctrl’:
// perform mouse left click
Mouse.click(MOUSE_LEFT);
break;}

{// use the pushbuttons to control the keyboard:
if (digitalRead(SpaceButton) == HIGH);
Keyboard.write(‘SpaceBar’);

if (digitalRead(CButton) == HIGH);
Keyboard.write(‘C’);

if (digitalRead(ZButton) == HIGH);
Keyboard.write(‘Z’);

if (digitalRead(ShiftButton) == HIGH);
Keyboard.write(‘Shift’);

if (digitalRead(CtrlButton) ==HIGH);
Keyboard.write(‘Ctrl’);

}

 case 'SpaceButton':

There is no ‘SpaceButton’ character.
Ditto ‘Shift’, ditto ‘Ctrl’

Lose the semicolons after the "if"s.

switch (inChar) Missing an opening brace {

Thanks alot

@ayaanakmal

Moved your topic to it's current location / section as it is more suitable.

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.