Skip to content

Latest commit

 

History

History
87 lines (55 loc) · 1.15 KB

logic.adoc

File metadata and controls

87 lines (55 loc) · 1.15 KB

Logic! datatype

1. Abstract

The logic! datatype represents the boolean values true and false.

Logic! is a member of the following typesets: immediate!

2. Creation

Logic values can be created using literal syntax, or at runtime using a make constructor, or a to conversion.

to logic! converts to true for any value except for false and none.

>> to logic! 'hi
== true

>> to logic! 1
== true

>> to logic! 0
== true

>> to logic! none
== false

>> to logic! false
== false
Note
For boolean logic support, true and false values can be constructed from 1 and 0 using make.
>> make logic! 1
== true

>> make logic! 0
== false

>> make integer! true
== 1

>> make integer! false
== 0

3. Literal syntax

The predefined words true and false, or the serialized syntax:

#(true)

#(false)

4. Testing values

Use logic? to check if a value is of the logic! datatype.

>> logic? on
== true

Use type? to return the datatype of a given value.

>> type? false
== logic!

5. Predefined words

true, yes, on

false, no, off

5.1. Functions

to-logic