Which of the following is an example of a syntax error?

Karel tries to pick up a ball, but there is no ball to pick up.

A for loop uses commas instead of semicolons.

Karel crashes into a wall.

When run, the program does not match the result world.

1 answer

The example of a syntax error is:

A for loop uses commas instead of semicolons.

Syntax errors occur when the code deviates from the rules of the programming language, making it impossible for the code to be parsed and executed correctly. Using commas instead of semicolons in a for loop is a violation of syntax rules.