From ee1ec345228d71e59768563886aae2238c5ff61b Mon Sep 17 00:00:00 2001 From: Garrit Franke Date: Sat, 13 Feb 2021 14:41:35 +0100 Subject: [PATCH] docs: use assignment operators --- docs/concepts/control-flow.md | 2 +- examples/bubblesort.sb | 4 ++-- lib/stdio.sb | 2 +- src/parser/tests.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/concepts/control-flow.md b/docs/concepts/control-flow.md index 7a4a306..369c5cc 100644 --- a/docs/concepts/control-flow.md +++ b/docs/concepts/control-flow.md @@ -113,7 +113,7 @@ fn main() { while index < 5 { println("the value is: " + a[index]) - index = index + 1 + index += 1 } } ``` diff --git a/examples/bubblesort.sb b/examples/bubblesort.sb index f800bf9..902b893 100644 --- a/examples/bubblesort.sb +++ b/examples/bubblesort.sb @@ -14,10 +14,10 @@ fn main() { arr[d+1] = swap } - d = d + 1 + d += 1 } - c = c + 1 + c += 1 } println(arr) diff --git a/lib/stdio.sb b/lib/stdio.sb index cf46fd5..e5cb55f 100644 --- a/lib/stdio.sb +++ b/lib/stdio.sb @@ -13,7 +13,7 @@ fn println(msg: string) { fn len(arr: int[]): int { let c: int = 0 while arr[c] { - c = c + 1 + c += 1 } return c diff --git a/src/parser/tests.rs b/src/parser/tests.rs index 210b96b..5159f84 100644 --- a/src/parser/tests.rs +++ b/src/parser/tests.rs @@ -463,7 +463,7 @@ fn test_array_access_in_loop() { while i < 5 { println(x[i]) - i = i + 1 + i += 1 } } ";