Hi all,
I am currently working on the " Create a Game Using Classes and Objects" -project but I am stuck because when I try to create an instance of Student (student_one), I get a syntax error. What am I doing wrong?
Thanks!
Hi all,
I am currently working on the " Create a Game Using Classes and Objects" -project but I am stuck because when I try to create an instance of Student (student_one), I get a syntax error. What am I doing wrong?
Thanks!
Classic interpreter/compiler mistake. You get told there’s a syntax error in a line that seems fine. But that’s because the syntax error appears on the line before.
To understand why this is, when tokens are being parsed if you have an open parenthesis, it needs to look for the next closing parenthesis unless it runs into an invalid token in-between.
In this case we have (
… some expressions
and then identifier
and =
, which is syntactically incorrect, given the placement of the identifier and the assignment operator.
That’s a very long-winded way to say you’re missing a closing parens.