true Value Data Types

false (value)


The false value is a boolean "zero". It is the only alternative of the boolean true. Data and Methods can use the value false as a test or flag value.

Examples

Suppose we want to attach the image pointer image to a CImage object I. The following script fragment tests whether Attach was successful:

 

bSuccess = I:Attach( image )

-- returns true if image is attached.

if ( bSuccess == false ) then Exit() end

-- Exit if bSuccess is false

 

Alternatively, the same result may be obtained by simpler, more compact code that does not test against false:

 

bSuccess = I:Attach( image )

-- returns true if image is attached.

if ( not bSuccess ) then Exit() end

-- Exit if bSuccess is false

Related Topics

true, nil