Skip to content

Commit

Permalink
Add introduction to booleans concept (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
BNAndras authored Oct 16, 2023
1 parent cb0f250 commit af7e2ae
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 6 deletions.
4 changes: 2 additions & 2 deletions concepts/booleans/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"blurb": "TODO: add blurb for this concept",
"blurb": "Pyret provides a Boolean primitive with two distinct values: 'true' and 'false'.",
"authors": [
"YourNameHere"
"BNAndras"
],
"contributors": []
}
37 changes: 36 additions & 1 deletion concepts/booleans/about.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# TODO: Add about for this concept
# Introduction

Pyret has two distinct Boolean primitives, `true` and `false`.
These two values represent whether a statement or condition is valid or not.

```pyret
"a" == "a" # true
"a" == "b" # false
```

Pyret provides the operators `and` and `or` that can combine Boolean values.

The and operator returns true if both sides are true and false for all other combinations.

```pyret
true and true # true
true and false # true
false and true # false
false and false # false
```

The or operator returns true if at least one side is true and false if both sides are false.

```pyret
true or true # true
true or false # true
false or true # true
false or false # false
```

`not()` is a built-in function that flips a true to false or a false to true.

```pyret
not(true) # false
not(false) # true
```
37 changes: 36 additions & 1 deletion concepts/booleans/introduction.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# TODO: Add introduction for this concept
# Introduction

Pyret has two distinct Boolean primitives, `true` and `false`.
These two values represent whether a statement or condition is valid or not.

```pyret
"a" == "a" # true
"a" == "b" # false
```

Pyret provides the operators `and` and `or` that can combine Boolean values.

The and operator returns true if both sides are true and false for all other combinations.

```pyret
true and true # true
true and false # true
false and true # false
false and false # false
```

The or operator returns true if at least one side is true and false if both sides are false.

```pyret
true or true # true
true or false # true
false or true # true
false or false # false
```

`not()` is a built-in function that flips a true to false or a false to true.

```pyret
not(true) # false
not(false) # true
```
4 changes: 2 additions & 2 deletions concepts/booleans/links.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"url": "http://example.com/",
"description": "TODO: add new link (above) and write a short description here of the resource."
"url": "https://pyret.org/docs/latest/A_Tour_of_Pyret.html#%28part._.Booleans%29",
"description": "A Tour of Pyret: Booleans"
}
]

0 comments on commit af7e2ae

Please sign in to comment.