Skip to content

Commit 988df1e

Browse files
authored
boolean to Boolean (#2311)
1 parent 6bbc8f3 commit 988df1e

File tree

28 files changed

+44
-44
lines changed

28 files changed

+44
-44
lines changed

concepts/arrays/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ foreach (char vowel in vowels)
7979
A `for` loop does have some advantages over a `foreach` loop:
8080

8181
- You can start or stop at the index you want.
82-
- You can use any (boolean) termination condition you want.
82+
- You can use any (Boolean) termination condition you want.
8383
- You can skip elements by customizing the incrementing of the loop variable.
8484
- You can process collections from back to front by counting down.
8585
- You can use `for` loops in scenarios that don't involve collections.

concepts/booleans/about.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Booleans in C# are represented by the `bool` type, which values can be either `true` or `false`.
44

5-
C# supports four [boolean operators][operators]: `!` (NOT), `&&` (AND), `||` (OR), and `^` (XOR). The `&&` and `||` operators use _short-circuit evaluation_, which means that the right-hand side of the operator is only evaluated when needed.
5+
C# supports four [Boolean operators][operators]: `!` (NOT), `&&` (AND), `||` (OR), and `^` (XOR). The `&&` and `||` operators use _short-circuit evaluation_, which means that the right-hand side of the operator is only evaluated when needed.
66

77
```csharp
88
true || false // => true
@@ -11,7 +11,7 @@ true ^ false // => true
1111
true ^ true // => false
1212
```
1313

14-
The three boolean operators each have a different [_operator precedence_][precedence]. As a consequence, they are evaluated in this order: `not` first, `&&` second, `^` third, and finally `||`. If you want to 'escape' these rules, you can enclose a boolean expression in parentheses (`()`), as the parentheses have an even higher operator precedence.
14+
The three Boolean operators each have a different [_operator precedence_][precedence]. As a consequence, they are evaluated in this order: `not` first, `&&` second, `^` third, and finally `||`. If you want to 'escape' these rules, you can enclose a Boolean expression in parentheses (`()`), as the parentheses have an even higher operator precedence.
1515

1616
```csharp
1717
!true && false // => false

concepts/booleans/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Booleans in C# are represented by the `bool` type, whose values can be either `true` or `false`.
44

5-
C# supports three boolean operators: `!` (NOT), `&&` (AND), and `||` (OR).
5+
C# supports three Boolean operators: `!` (NOT), `&&` (AND), and `||` (OR).

concepts/const-readonly/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ By default, values in C# are _mutable_, that is they can change over time. To ma
77

88
The `const` modifier has some restrictions:
99

10-
1. It can only be applied to "constant" types: strings, booleans and numbers.
10+
1. It can only be applied to "constant" types: strings, Booleans and numbers.
1111
1. The `const` value must be initialized immediately.
1212

1313
See [defining constants][defining-constants] for more information.

concepts/const-readonly/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ By default, values in C# are _mutable_, that is they can change over time. To ma
77

88
The `const` modifier has some restrictions:
99

10-
1. It can only be applied to "constant" types: strings, booleans and numbers.
10+
1. It can only be applied to "constant" types: strings, Booleans and numbers.
1111
1. The `const` value must be initialized immediately.
1212

1313
If your value is a non-constant type or you need to initialize the value in a constructor, `readonly` can be used to enforce immutability.

concepts/enums/about.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ enum Priority : byte
4040

4141
## Convert to an Enum member
4242

43-
You should always consider using an enum whenever you want to model something like a boolean. Besides the aforementioned readability benefits, enums have another advantage over booleans: new values can always be added to an enum, whereas a boolean value will only ever be `true` or `false`. Using an enum is thus more future proof.
43+
You should always consider using an enum whenever you want to model something like a Boolean. Besides the aforementioned readability benefits, enums have another advantage over Booleans: new values can always be added to an enum, whereas a Boolean value will only ever be `true` or `false`. Using an enum is thus more future proof.
4444

4545
```csharp
4646
enum Status
@@ -71,7 +71,7 @@ Status status = (Status)Enum.Parse(typeof(Status), input);
7171
// Inactive
7272
```
7373

74-
To check if a name or a value exists in the enum, you can use [`Enum.TryParse`][enum tryparse] or [`Enum.IsDefined`][enum isdefined], both return a boolean indicating if the enum member exists:
74+
To check if a name or a value exists in the enum, you can use [`Enum.TryParse`][enum tryparse] or [`Enum.IsDefined`][enum isdefined], both return a Boolean indicating if the enum member exists:
7575

7676
```csharp
7777
bool doesExist = Enum.IsDefined(typeof(Status), "Inexistent");

concepts/exception-filtering/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# About
22

33
`when` is the keyword in filtering exceptions. It is placed after the catch
4-
statement and can take a boolean expression containing any values in scope at the time. They don't just have to be members of the exception itself. If the type of the exception matches and the expression evaluates to true then the block associated with that `catch` statement is executed otherwise the next `catch` statement, if any, is checked.
4+
statement and can take a Boolean expression containing any values in scope at the time. They don't just have to be members of the exception itself. If the type of the exception matches and the expression evaluates to true then the block associated with that `catch` statement is executed otherwise the next `catch` statement, if any, is checked.
55

66
```csharp
77
try

concepts/exception-filtering/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Introduction
22

33
`when` is the keyword in filtering exceptions. It is placed after the catch
4-
statement and can take a boolean expression containing any values in scope at the time. If the expression evaluates to true then the block associated with that `catch` statement is executed otherwise the next `catch` statement, if any, is checked.
4+
statement and can take a Boolean expression containing any values in scope at the time. If the expression evaluates to true then the block associated with that `catch` statement is executed otherwise the next `catch` statement, if any, is checked.
55

66
```csharp
77
try

concepts/for-loops/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"blurb": "For-loops allow for iteration over a specified range, with a boolean condition to indicate when to stop, and an increment to indicate how much to go up or down by.",
2+
"blurb": "For-loops allow for iteration over a specified range, with a Boolean condition to indicate when to stop, and an increment to indicate how much to go up or down by.",
33
"authors": [
44
"ErikSchierboom"
55
],

concepts/for-loops/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ foreach (char vowel in vowels)
4242
A `for` loop does have some advantages over a `foreach` loop:
4343

4444
- You can start or stop at the index you want.
45-
- You can use any (boolean) termination condition you want.
45+
- You can use any (Boolean) termination condition you want.
4646
- You can skip elements by customizing the incrementing of the loop variable.
4747
- You can process collections from back to front by counting down.
4848
- You can use `for` loops in scenarios that don't involve collections.

concepts/foreach-loops/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ foreach (char vowel in vowels)
4444
A `for` loop does have some advantages over a `foreach` loop:
4545

4646
- You can start or stop at the index you want.
47-
- You can use any (boolean) termination condition you want.
47+
- You can use any (Boolean) termination condition you want.
4848
- You can skip elements by customizing the incrementing of the loop variable.
4949
- You can process collections from back to front by counting down.
5050
- You can use `for` loops in scenarios that don't involve collections.

concepts/randomness/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ There are 3 patterns for implementing the last point:
1818

1919
- You can get the random number and manipulate it. In the case of the coding exercise this would consist of calling `Random.NextDouble()` and multiplying by 100. This [piece][random-use-case-array] discusses making random selections from an array.
2020
- You can inherit from `System.Random` and override the `Sample()` method.
21-
- You can encapsulate an instance of `System.Random` as a member of a class of your own, for example [to generate booleans][random-use-cases].
21+
- You can encapsulate an instance of `System.Random` as a member of a class of your own, for example [to generate Booleans][random-use-cases].
2222

2323
The numbers generated by `Random` are not guaranteed to be unique.
2424

concepts/while-loops/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"blurb": "A while loop continues looping until a boolean condition evaluates to false.",
2+
"blurb": "A while loop continues looping until a Boolean condition evaluates to false.",
33
"authors": [
44
"ErikSchierboom"
55
],

concepts/while-loops/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# About
22

3-
To repeatedly execute logic, one can use loops. One of the most common loop types in C# is the `while` loop, which keeps on looping until a boolean condition evaluates to `false`.
3+
To repeatedly execute logic, one can use loops. One of the most common loop types in C# is the `while` loop, which keeps on looping until a Boolean condition evaluates to `false`.
44

55
```csharp
66
int x = 23;

exercises/concept/annalyns-infiltration/.docs/hints.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## General
44

5-
- There are three [boolean operators][operators] to work with boolean values.
5+
- There are three [Boolean operators][operators] to work with Boolean values.
66
- Multiple operators can be combined in a single expression.
77

88
## 1. Check if a fast attack can be made
99

10-
- The [boolean operators][operators] can also be applied to boolean parameters.
10+
- The [Boolean operators][operators] can also be applied to Boolean parameters.
1111

1212
[operators]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/boolean-logical-operators

exercises/concept/annalyns-infiltration/.docs/instructions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ You have four tasks: to implement the logic for determining if the above actions
2424

2525
## 1. Check if a fast attack can be made
2626

27-
Implement the (_static_) `QuestLogic.CanFastAttack()` method that takes a boolean value that indicates if the knight is awake. This method returns `true` if a fast attack can be made based on the state of the knight. Otherwise, returns `false`:
27+
Implement the (_static_) `QuestLogic.CanFastAttack()` method that takes a Boolean value that indicates if the knight is awake. This method returns `true` if a fast attack can be made based on the state of the knight. Otherwise, returns `false`:
2828

2929
```csharp
3030
var knightIsAwake = true;
@@ -34,7 +34,7 @@ QuestLogic.CanFastAttack(knightIsAwake);
3434

3535
## 2. Check if the group can be spied upon
3636

37-
Implement the (_static_) `QuestLogic.CanSpy()` method that takes three boolean values, indicating if the knight, archer and the prisoner, respectively, are awake. The method returns `true` if the group can be spied upon, based on the state of the three characters. Otherwise, returns `false`:
37+
Implement the (_static_) `QuestLogic.CanSpy()` method that takes three Boolean values, indicating if the knight, archer and the prisoner, respectively, are awake. The method returns `true` if the group can be spied upon, based on the state of the three characters. Otherwise, returns `false`:
3838

3939
```csharp
4040
var knightIsAwake = false;
@@ -46,7 +46,7 @@ QuestLogic.CanSpy(knightIsAwake, archerIsAwake, prisonerIsAwake);
4646

4747
## 3. Check if the prisoner can be signalled
4848

49-
Implement the (_static_) `QuestLogic.CanSignalPrisoner()` method that takes two boolean values, indicating if the archer and the prisoner, respectively, are awake. The method returns `true` if the prisoner can be signalled, based on the state of the two characters. Otherwise, returns `false`:
49+
Implement the (_static_) `QuestLogic.CanSignalPrisoner()` method that takes two Boolean values, indicating if the archer and the prisoner, respectively, are awake. The method returns `true` if the prisoner can be signalled, based on the state of the two characters. Otherwise, returns `false`:
5050

5151
```csharp
5252
var archerIsAwake = false;
@@ -57,7 +57,7 @@ QuestLogic.CanSignalPrisoner(archerIsAwake, prisonerIsAwake);
5757

5858
## 4. Check if the prisoner can be freed
5959

60-
Implement the (_static_) `QuestLogic.CanFreePrisoner()` method that takes four boolean values. The first three parameters indicate if the knight, archer and the prisoner, respectively, are awake. The last parameter indicates if Annalyn's pet dog is present. The method returns `true` if the prisoner can be freed based on the state of the three characters and Annalyn's pet dog presence. Otherwise, it returns `false`:
60+
Implement the (_static_) `QuestLogic.CanFreePrisoner()` method that takes four Boolean values. The first three parameters indicate if the knight, archer and the prisoner, respectively, are awake. The last parameter indicates if Annalyn's pet dog is present. The method returns `true` if the prisoner can be freed based on the state of the three characters and Annalyn's pet dog presence. Otherwise, it returns `false`:
6161

6262
```csharp
6363
var knightIsAwake = false;

exercises/concept/annalyns-infiltration/.docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
Booleans in C# are represented by the `bool` type, which values can be either `true` or `false`.
66

7-
C# supports three boolean operators: `!` (NOT), `&&` (AND), and `||` (OR).
7+
C# supports three Boolean operators: `!` (NOT), `&&` (AND), and `||` (OR).

exercises/concept/annalyns-infiltration/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
"forked_from": [
2323
"fsharp/annalyns-infiltration"
2424
],
25-
"blurb": "Learn about booleans while helping Annalyn rescue her friend."
25+
"blurb": "Learn about Booleans while helping Annalyn rescue her friend."
2626
}

exercises/concept/annalyns-infiltration/.meta/design.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
## Learning objectives
44

55
- Know of the existence of the `bool` type and its two values.
6-
- Know about boolean operators and how to build logical expressions with them.
7-
- Know of the boolean operator precedence rules.
6+
- Know about Boolean operators and how to build logical expressions with them.
7+
- Know of the Boolean operator precedence rules.
88

99
## Out of scope
1010

11-
- Pattern matching on booleans.
11+
- Pattern matching on Booleans.
1212

1313
## Concepts
1414

15-
- `booleans`: know of the existence of the `bool` type and its two values; know about boolean operators and how to build logical expressions with them; know of the boolean operator precedence rules.
15+
- `booleans`: know of the existence of the `bool` type and its two values; know about Boolean operators and how to build logical expressions with them; know of the Boolean operator precedence rules.
1616

1717
## Prerequisites
1818

exercises/concept/instruments-of-texas/.docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Exception Filtering
44

55
`when` is the keyword in filtering exceptions. It is placed after the catch
6-
statement and can take a boolean expression containing any values in scope at the time. If the expression evaluates to true then the block associated with that `catch` statement is executed otherwise the next `catch` statement, if any, is checked.
6+
statement and can take a Boolean expression containing any values in scope at the time. If the expression evaluates to true then the block associated with that `catch` statement is executed otherwise the next `catch` statement, if any, is checked.
77

88
```csharp
99
try

exercises/concept/interest-is-interesting/.meta/design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
This exercise's prerequisites Concepts are:
2525

26-
- `numbers`: define numbers and apply arithmetic and boolean logic to them.
26+
- `numbers`: define numbers and apply arithmetic and Boolean logic to them.
2727
- `if-statements`: conditionally execute code based on value of floating-point numbers.
2828

2929
[docs.microsoft.com-floating-point-numeric-types]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types

exercises/concept/wizards-and-warriors/.meta/design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- `classes`: know how to work with classes.
2424
- `constructors`: know how to work with constructors.
2525
- `strings`: know how to do basic string interpolation.
26-
- `boolean`: know how to use boolean logic.
26+
- `boolean`: know how to use Boolean logic.
2727
- `if-statements`: know how to do conditional logic.
2828

2929
## Analyzer

exercises/practice/leap/.approaches/boolean-chain/content.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Chain of boolean expressions
1+
# Chain of Boolean expressions
22

33
```csharp
44
public static bool IsLeapYear(int year)
@@ -7,7 +7,7 @@ public static bool IsLeapYear(int year)
77
}
88
```
99

10-
The first boolean expression uses the [remainder operator][remainder-operator] to check if the year is evenly divided by `4`.
10+
The first Boolean expression uses the [remainder operator][remainder-operator] to check if the year is evenly divided by `4`.
1111
- If the year is not evenly divisible by `4`, then the chain will "short circuit" due to the next operator being a [logical AND][logical-and] (`&&`), and will return `false`.
1212
- If the year _is_ evenly divisible by `4`, then the year is checked to _not_ be evenly divisible by `100`.
1313
- If the year is not evenly divisible by `100`, then the expression is `true` and the chain will "short-circuit" to return `true`,
@@ -22,7 +22,7 @@ since the next operator is a [logical OR][logical-or] (`||`).
2222
| 1900 | true | false | false | false |
2323

2424

25-
The chain of boolean expressions is efficient, as it proceeds from testing the most likely to least likely conditions.
25+
The chain of Boolean expressions is efficient, as it proceeds from testing the most likely to least likely conditions.
2626

2727
## Shortening
2828

exercises/practice/leap/.approaches/config.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"uuid": "54148cc8-e3bf-4981-95c9-cb584c658c76",
1313
"slug": "boolean-chain",
1414
"title": "Boolean chain",
15-
"blurb": "Use a chain of boolean expressions.",
15+
"blurb": "Use a chain of Boolean expressions.",
1616
"authors": [
1717
"bobahop"
1818
],
@@ -26,7 +26,7 @@
2626
"uuid": "eebe5a57-7e58-44c2-92e6-50f46f1251ac",
2727
"slug": "ternary-operator",
2828
"title": "Ternary operator",
29-
"blurb": "Use a ternary operator of boolean expressions.",
29+
"blurb": "Use a ternary operator of Boolean expressions.",
3030
"authors": [
3131
"bobahop"
3232
],
@@ -44,7 +44,7 @@
4444
"uuid": "cb7c88a6-49f3-4744-a3e8-fcc7acc0770d",
4545
"slug": "switch-on-a-tuple",
4646
"title": "switch on a tuple",
47-
"blurb": "Use a switch on a tuple made from boolean expressions.",
47+
"blurb": "Use a switch on a tuple made from Boolean expressions.",
4848
"authors": [
4949
"bobahop"
5050
],

exercises/practice/leap/.approaches/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Introduction
22

33
There are various idiomatic approaches to solve Leap.
4-
You can use a chain of boolean expressions to test the conditions.
4+
You can use a chain of Boolean expressions to test the conditions.
55
Or you can use a [ternary operator][ternary-operator].
66
Another approach you can use is a [switch][switch] on a [tuple][tuple].
77

@@ -59,7 +59,7 @@ Besides the aforementioned, idiomatic approaches, you could also solve the exerc
5959

6060
## Which approach to use?
6161

62-
- The chain of boolean expressions is most efficient, as it proceeds from the most likely to least likely conditions.
62+
- The chain of Boolean expressions is most efficient, as it proceeds from the most likely to least likely conditions.
6363
It has a maximum of three checks.
6464
- The ternary operator has a maximum of only two checks, but it starts from a less likely condition.
6565
- The `switch` on a `tuple` may be considered more "functional", but it is more verbose and may be considered less readable.

exercises/practice/leap/.articles/performance/content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In this approach, we'll find out how to most efficiently calculate if a year is
44

55
The [approaches page][approaches] lists three idiomatic approaches to this exercise:
66

7-
1. [Using the boolean chain][approach-boolean-chain]
7+
1. [Using the Boolean chain][approach-boolean-chain]
88
2. [Using the ternary operator][approach-ternary-operator]
99
3. [Using `switch` in a `tuple`][approach-switch-on-a-tuple]
1010

0 commit comments

Comments
 (0)