-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add introduction to booleans concept (#155)
- Loading branch information
Showing
4 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] |