Unqualified id error message

Please let me know how to fix this error message and what it means so I can get the code to run...
thanks
the code message and error code is below

Arduino: 1.8.19 (Mac OS X), Board: "Arduino Uno"

spaceship:1:1: error: expected unqualified-id before numeric constant
1 int switchstate = 0;
^
spaceship:2:1: error: expected unqualified-id before numeric constant
2 void setup() {
^
spaceship:10:1: error: expected unqualified-id before numeric constant
8 void loop() {
^
spaceship:22:1: error: expected unqualified-id before numeric constant
17 else // the button is pressed
^~
spaceship:24:1: error: expected unqualified-id before numeric constant
19 digitalWrite(4, LOW);
^~
spaceship:25:1: error: expected unqualified-id before numeric constant
20 digitalWrite(5, HIGH);
^~
spaceship:28:1: error: expected unqualified-id before numeric constant
21 delay(250); // wait for a quarter second
^~
spaceship:29:1: error: expected unqualified-id before numeric constant
22 // toggle the LEDS
^~
spaceship:31:1: error: expected unqualified-id before numeric constant
24 digitalWrite(5, LOW);
^~
spaceship:32:1: error: expected unqualified-id before numeric constant
25 delay(250); // wait for a quarter second
^~
spaceship:34:1: error: expected unqualified-id before numeric constant
26 }
^~
spaceship:34:4: error: expected declaration before '}' token
26 }
^
exit status 1
expected unqualified-id before numeric constant

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Please don't post images of code or error messages.

Do you see that button "Copy error messages"?. Use that to copy them and next paste them in a reply using code tags.

Please post code using code tags as described in How to get the best out of this forum. You can not expect us to type it all to try to find the error.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the Installation & Troubleshooting category.

It looks like you copied the code from a page that has line numbers added. Remove the line numbers.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.