Hi - noob question here but it goes to the logic of how the code is read.
If it’s read top to bottom, how does it know what “StartGame” is inside “Game” if it isn’t defined until after it’s called?
Thanks for any help!
S
Hi - noob question here but it goes to the logic of how the code is read.
If it’s read top to bottom, how does it know what “StartGame” is inside “Game” if it isn’t defined until after it’s called?
Thanks for any help!
S
Hi Steve,
That’s a good question.
Methods and variables inside a method are not read/executed line by line. They are just defined there. For this reason, their order does not matter.
The code inside methods gets executed line by line, which makes sense, because you wire up the logic there.
Aha thanks! So the code isn’t literally read top to bottom. I was taking it literally in all cases.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.