Weapon Types
SWITCH STATEMENT | GAME BASED EXAMPLE
GOAL: Create a simple switch statement to compare the player's weapon and execute the proper code accordingly
CODE BREAK-DOWN
LINE 5 --> Switch statement is declared that will evaluate the value of the variable _weaponType and compare it to each case
LINE 7, 10, & 13 --> Once the statement finds a case value that matches the value of _weaponType, the program runs the associated code
Last updated