Why does a delay make my stepper stop? And why does the break command raise an error?
... why the break command raises and error?


Because you are using it wrong! break will end a loop, and is used in the switch...case statements. Read the documentation for break if you need to know more


  I have fixed it, the delay at the end fixes it for some reason. I don’t know why though. 


You haven't really fixed it if you don't know why. It seems that you are trying to directly control a 5 wire stepper, i assume your pins must drive a transistor or something as the arduino pins themselves will not work.

The reason it works is because the stepper takes time to energize and move, if you don't wait long enough it won't work, your serial.print must be long enough, as the delay(1) should produce a 1ms delay which is too short.

You are driving your stepper wrong, you have the code setup for a half-step control, but you have 9 states, state 8 in not needed.

you are duplicating effort you don't need with both _steps and _switches, they always have the same value.

you can do better on your code as well:

int dir = 1
int c = 0

// in loop
c += dir

if (c &gt; max)
{
  dir *= -1
  c = max
}

if (c &lt; min)
{
  dir *= -1
  c = min
}


With this you don't have to check the direction to modify your variables.