False
Parameters
| None. |
Description
|
A built-in constant with the value 0, used to mean "no" in a condition. False is a keyword, not a function, so it takes no brackets, and like True it is folded into a plain number at compile time. It exists to make code read as English. game_over = False at the start of a round, Return False from a function that could not do its job, and If visible = False Then ... all say what they mean more clearly than a bare 0 would. Zero is the language's idea of false everywhere: an If, While or Until treats any zero value as false and anything else as true, an empty string counts as false when converted, and a Null type handle is zero too. So If Not thing and If thing = False do the same job. Remember that Blitz3D+ comparisons return 1 for true and 0 for false, so comparing against False is reliable, while comparing an arbitrary number against True is not. See also: True, If, Not, Select, Null. |
Example
; False Example ; ------------- ; False is a built-in constant equal to 0 - the natural starting ; value for a flag recording something that has not happened yet. Print "The value of False is "+False Print "" ; Start flags at False, set them when the event happens door_open=False If Not door_open Then Print "The door starts closed." door_open=True If door_open Then Print "Now the door is open." Print "" ; A function can answer no by returning False If Not HasWon(40) Then Print "Score 40: not a win yet." If HasWon(150) Then Print "Score 150: you win!" Print "" Print "Press any key to close the example" WaitKey End Function HasWon(score) ; 100 points or more wins the game If score<100 Then Return False Return True End Function
Index