Well, if statements are really the fundamental building block of programming. In assembly language, if statements are comparable to branch statements, which tells the execution to hop from the branch to the line of code to which it points.
So, yes and no. All logic driven code is done with branch statements, but there is a considerable amount of stuff happening in between. From a code density perspective, no, most lines of a game’s code are not if statements. However, in the underlying libraries used by the game, a single method call might entail the use of 100 if statements.
Latest Answers