diff --git a/concepts/booleans/.meta/config.json b/concepts/booleans/.meta/config.json index 72aa251..8182c9b 100644 --- a/concepts/booleans/.meta/config.json +++ b/concepts/booleans/.meta/config.json @@ -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": [] } \ No newline at end of file diff --git a/concepts/booleans/about.md b/concepts/booleans/about.md index e3aab23..d371438 100644 --- a/concepts/booleans/about.md +++ b/concepts/booleans/about.md @@ -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 +``` diff --git a/concepts/booleans/introduction.md b/concepts/booleans/introduction.md index 63af712..d371438 100644 --- a/concepts/booleans/introduction.md +++ b/concepts/booleans/introduction.md @@ -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 +``` diff --git a/concepts/booleans/links.json b/concepts/booleans/links.json index 4840efb..ce73316 100644 --- a/concepts/booleans/links.json +++ b/concepts/booleans/links.json @@ -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" } ]