While loop error

so recently i have been following the unreal engine course and at Section 2 Lecture 26 i have a problem on Visual studio code. (look at screenshots)


so the errors are:
error C2059: syntax error: ‘while’
error C2143: syntax error: missing ‘;’ before ‘{’
error C2447: ‘{’: missing function header (old-style formal list?)
i cannot explain these errors but i dont get something about the second error
error C2143 it says missing ; before { on line 46 which means it has to be this way
while (true);
insteat of just
while (true)

so yes after putting a semicolon after the while loop i didnt get the second error but why? becouse the if and else statements didnt require an semicolon so why does the while require it? but while giving the lesson ben didnt had to put a semicolon on his work, as you can see on the screen.
thanks in advance

PS: i am new in these stuff so i dont get alot of stuff evena fter following the lecurs there are somethings that i dont get but i try to replay the videos and try my best to understand.

According to the this error, the compiler thinks that your while loop is a function.(That’s why it complains about the semicolon, perhaps.) Can you try removing the PlayGame() function call in the int main() and moving the while loop(and its contents) into the int main() and see if it resolves the issue?

1 Like

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