Referenced from lesson Simple Data Types

Boolean-producing expressions are yes-or-no questions and will always evaluate to either true (“yes”) or false (“no”). What will each of the expressions below evaluate to? Write down your prediction in the blanks provided and then type the code into the interactions area to see what it returns.

Prediction:

Computer Returns:

Prediction:

Computer Returns:

1 (<= 3 4)

2 (string>? "a" "b")

3 (= 3 2)

4 (string<? "a" "b")

5 (< 2 4)

6 (string=? "a" "b")

7 (>= 5 5)

8 (string<>? "a" "a")

9 (>= 4 6)

10 (string>=? "a" "a")

11 (<> 3 3)

12 (string<>? "a" "b")

13 In your own words, describe what < does.

14 In your own words, describe what >= does.

15 In your own words, describe what <> does.

Prediction: Computer Returns:

16 (string=? "a tree" "trees")

17 (string=? "tree" "tree")

18 (string-contains? "catnap" "cat")

19 (string-contains? "cat" "catnap")

20 How many Numbers are there in the entire universe?

21 How many Strings are there in the entire universe?

22 How many Images are there in the entire universe?

23 How many Booleans are there in the entire universe?

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). CCbadge Bootstrap:Algebra by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.