Skip to content

Boolean

Background

Given a file named "pen.json" with:

{
  "type": "library",
  "dependencies": {}
}

Use boolean literals

Given a file named "Foo.pen" with:

f = \() boolean {
  true
}

g = \() boolean {
  false
}

When I run pen build

Then the exit status should be 0.

Use an and operation

Given a file named "Foo.pen" with:

f = \() boolean {
  true & false
}

When I run pen build

Then the exit status should be 0.

Use an or operation

Given a file named "Foo.pen" with:

f = \() boolean {
  true | false
}

When I run pen build

Then the exit status should be 0.

Use a not operation

Given a file named "Foo.pen" with:

f = \() boolean {
  !true
}

When I run pen build

Then the exit status should be 0.

Use an if expression

Given a file named "Foo.pen" with:

f = \() number {
  if true {
    1
  } else {
    0
  }
}

When I run pen build

Then the exit status should be 0.