Skip to content

Commit

Permalink
fix: corrected augmented assignment operations (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota authored Jun 29, 2024
1 parent c7e5db4 commit 89b035f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pages/book/operators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -607,42 +607,42 @@ let value: Int = 5;
// +=
value + 5; // adds 5
value = value + 5; // adds 5 and assigns result back
value += value; // also adds 5 and assigns result back
value += 5; // also adds 5 and assigns result back
// -=
value - 5; // subtracts 5
value = value - 5; // subtracts 5 and assigns result back
value -= value; // also subtracts 5 and assigns result back
value -= 5; // also subtracts 5 and assigns result back
// *=
value * 5; // multiplies by 5
value = value * 5; // multiplies by 5 and assigns result back
value *= value; // also multiplies by 5 and assigns result back
value *= 5; // also multiplies by 5 and assigns result back
// /=
value / 5; // divides by 5
value = value / 5; // divides by 5 and assigns result back
value /= value; // also divides by 5 and assigns result back
value /= 5; // also divides by 5 and assigns result back
// %=
value % 5; // gets modulo by 5
value = value % 5; // gets modulo by 5 and assigns result back
value %= value; // also gets modulo by 5 and assigns result back
value %= 5; // also gets modulo by 5 and assigns result back
// &=
value & 5; // bitwise ANDs 5
value = value & 5; // bitwise ANDs 5 and assigns result back
value &= value; // also bitwise ANDs 5 and assigns result back
value &= 5; // also bitwise ANDs 5 and assigns result back
// ^=
value ^ 5; // bitwise XORs 5
value = value ^ 5; // bitwise XORs 5 and assigns result back
value ^= value; // also bitwise XORs 5 and assigns result back
value ^= 5; // also bitwise XORs 5 and assigns result back
// |=
value | 5; // bitwise ORs 5
value = value | 5; // bitwise ORs 5 and assigns result back
value |= value; // also bitwise ORs 5 and assigns result back
value |= 5; // also bitwise ORs 5 and assigns result back
```

[p]: /book/types#primitive-types
Expand Down

0 comments on commit 89b035f

Please sign in to comment.