Some tests—for example, a test to see if a number is even or if a letter is a vowel—are needed so often that you won't want to re-create them each time you need them. In this activity, you will create a set of tools that you may use often, especially for complicated programming tasks.
You've already built a predicate vowel?
to test for vowels and a predicate to test for even numbers. snap has a built-in test to see if something is a number, but not a test to see if the number is an integer, and often you will want that.
>
), an "equal" operator (=
), and a "less than" operator (<
) built in, but doesn't have a "greater than or equal to" (>=
) operator.
Build and test it well to make sure it does what you expect.
>=
between the two input slots, use the left plus sign in the Block Editor.
There are several correct ways to do this! As long as your block gives the right true
and false
answers, it's correct.
You may find useful.