Skip to content

Commit 6b7a733

Browse files
authored
Improve style in tim-from-marketing/.docs/introduction.md (#2319)
Nothing major, just a few small adjustments I thought improved it slightly.
1 parent d46e0c8 commit 6b7a733

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

exercises/concept/tim-from-marketing/.docs/introduction.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
In C#, the `null` literal is used to denote the absence of a value. A _nullable_ type is a type that allows for `null` values.
66

7-
Prior to C# 8.0, reference types were always nullable and value types were not. A value type can be made nullable though by appending it with a question mark (`?`).
7+
Prior to C# 8.0, reference types were always nullable and value types were not. A value type can be made nullable by appending a question mark to it (`?`).
88

99
```csharp
1010
string nullableReferenceType = "hello";
@@ -17,7 +17,7 @@ int? nullableValueType = 5; // Define nullable value type
1717
nullableValueType = null; // Valid as type is nullable
1818
```
1919

20-
Accessing a member of a variable which value is `null` will compile fine, but result in a `NullReferenceException` being thrown at runtime:
20+
Accessing a null variable's member does not cause a compile error, but results in a `NullReferenceException` being thrown at runtime:
2121

2222
```csharp
2323
string sentence = null;
@@ -36,7 +36,7 @@ string? nullableReferenceType = "movie";
3636
nullableReferenceType = null; // Valid as type is nullable
3737
```
3838

39-
To safely work with nullable values, one should check if they are `null` before working with them:
39+
To safely work with nullable values, check if they are `null` before using them:
4040

4141
```csharp
4242
string NormalizedName(string? name)
@@ -45,12 +45,10 @@ string NormalizedName(string? name)
4545
{
4646
return "UNKNOWN";
4747
}
48-
else
49-
{
50-
// Value is not null at this point, so no compile warning
51-
// and no runtime NullReferenceException being thrown
52-
return name.ToUpper();
53-
}
48+
49+
// Value is not null at this point, so no compile warning
50+
// and no runtime NullReferenceException being thrown
51+
return name.ToUpper();
5452
}
5553

5654
NormalizedName(null); // => "UNKNOWN"

0 commit comments

Comments
 (0)