Invalid Values


Interactive Lesson: Click Here

Creating Variable

To understand what an Invalid Value does, we need to first create a variable and make it ask a number. To do this you have to create a variable then by going to wall, then ask number, you make the program to ask you enter a number.

Now we need to check if this is an invalid value, so we need to use the function is invalid. This returns true or false. It will return true is the variable is invalid and false otherwise. We need to create another variable to store the Boolean value (True/False). To do this create a variable then in the keypad click the variable name of the previous variable you created. For example if you have name the x, then the x should appear on the keypad. Now click x then click is invalid.

Now we need to print this. To do this click the name of the variable in the keypad, then click post to wall or you could type it in the search box in the left corner of the screen.

Now run the program by clicking the play button. In the textbook don't enter anything and press ok. If the program displays true then it's working.

Now run the program again, this time enter a value the result should be false.


Download pdf:

Click to Download pdf