Skip to content

Commit 37adb9d

Browse files
Merge pull request #3 from dangerman/fix-csharp-const-example
Fix C# const example
2 parents fff0fc6 + 97e0425 commit 37adb9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/pages/basics/variables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const x = 1; // Block scope; immutable
2424

2525
```csharp
2626
var x = 1; // Block scope
27-
const x = 1; // Compiler "inlined"; NOT the same as JS const
2827
```
2928

3029
</template>
@@ -33,7 +32,7 @@ const x = 1; // Compiler "inlined"; NOT the same as JS const
3332
::: warning Use C# `record` classes for immutability
3433
C#'s `const` keyword does not mean the same thing as in JS. [See the docs](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/const) to understand the `const` designator in C#.
3534

36-
To achieve immutability, use C# `record` class classes with positional properties (which we'll visit later in [Classes and Types](./classes.md#record-classes)).
35+
To achieve immutability, use C# `record` classes with positional properties (which we'll visit later in [Classes and Types](./classes.md#record-classes)).
3736
:::
3837

3938
## Explicit Types
@@ -57,6 +56,7 @@ let map = new Map();
5756
// Primitives
5857
int x = 1;
5958
string y = "";
59+
const int x = 1; // Compiler "inlined"; NOT the same as JS const
6060
6161
// Reference types
6262
var map = new HashMap();

0 commit comments

Comments
 (0)