This chapter covered the extremely important subjects of branching and subroutines, which are both related in functionality. Branching statements allow you to apply rules to a program to keep the program running in a predetermined manner and behaving correctly. In addition, you learned how to use the IF … ELSE … ENDIF statement to apply logic and rule enforcement to your programs. This chapter also showed you how to create and use your own functions, complete with parameters and return values. Functions greatly enhance the capabilities of your games, allowing you to extend DarkBASIC beyond what the designers imagined.