Table of contents
- Preface
- General background information
-
Preview
- A real-world example
- The not operator
- The reality - logic in a formal sense
- A sample program named Logical01
- Meaningful variable names
- Insufficient space
- A truth table
- What does this mean?
- The and operation
- The inclusive or operation
- A practical example
- Evaluation against trial values
- Let's walk through this
- Can become very complex
- Program output
- Discussion and sample code
- Run the program
- Student programming projects
- Summary
- What's next?
- Resources
- Miscellaneous
Preface
Scratch 2.0 (released May 9, 2013) is the second major version of Scratch to be released during the life of the product. Among other things, it features a redesigned editor andwebsite, and allows you to edit projects directly from your web browser.
This module (tutorial) is one in a collection of modules designed to help beginners of all ages (8 and up) learn how to create the code for computer programs using Scratch 2.0 . Information is provided not only for the beginners themselves but also for theirparents and teachers where appropriate.
The purpose of this module is to teach you about logical operators and truth tables . You will also learn how to write a Scratch program that illustrates the use of the logical and , or , and not operators when used in conjunction with relational operators.
You learned about relational operators in an earlier module.
Viewing tip
I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the images while youare reading about them.
Images
- Image A . Reduced screen shot of the programmer interface for the program named Logical01.
- Image B . A simple truth table.
- Image C . A truth table for the logic in the program named Logical01.
- Image D . Program output for row 1 in Image C.
- Image E . Program output for row 2 in Image C.
- Image F . Program output for row 3 in Image C.
- Image G . Programming panel for the program named Logical01.
- Image H . Program output from the program named Logical02.
General background information
There are many different kinds of operators. The easiest way to study them is to divide them into categories such as the following
- arithmetic
- relational
- logical
- bitwise
- assignment
Earlier modules explained arithmetic operators and relational operators. This module will explain logical operators. Future modules will deal with theremaining kinds of operators.