Chapter 9

Helping with Logic Operations

IN THIS CHAPTER

check Understanding logic operations

check Using conditionals

check Putting multiple logic operations together

check Coding a rock, paper, scissors game

Logic is the heart of programming. A computer program is essentially a giant set of logic statements, or rules, that execute in order. Similar to any decision-based field — law, forensic science, football, driving — programming enumerates rules that are put together logically. As the program executes, different subsets of rules are accessed, testing conditions and producing decisions, or outcomes. Outcomes then lead to the execution of other subsets of rules within the program, and so on.

This chapter guides you in helping your young coder master the application of logic in coding. Specifically, it helps you coach him in writing conditionals, also called if-then commands, beginning with easy ones. You also use and, not, and or commands to construct intended meaning in a conditional. Combining several logic operations together allows your coder to build up to increasingly more complex commands. By the ...

Get Helping Kids with Coding For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.