New user - quite confused!

If we make reasonable assumptions about what your code actually looks like (you should read the pinned thread to see how to format the code properly so we can see it properly), there is nothing wrong with it. The problem is with how you use VSCode to provide and run the code.

So: Exactly what steps do you take to provide the code to VSCode, and then tell it to run that code?

And then: Exactly how does it “tell you syntax error”? Please copy and paste the entire response if it can be copied, and format it like multi-line code (following the same instructions in the pinned thread). If it can’t be copied, show a screen capture (using your operating system’s tools, not a cell phone or digital camera to take a picture).