mutable decl syntax change
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Compound assignment (`+=`, `-=`, `*=`, `/=`) and explicit integer division.
|
||||
|
||||
check_float func() i32 {
|
||||
x f64 = 10.0
|
||||
x f64 := 10.0
|
||||
x /= 4.0 # 2.5
|
||||
x *= 2.0 # 5.0
|
||||
x -= 1.0 # 4.0
|
||||
@@ -13,7 +13,7 @@ check_float func() i32 {
|
||||
}
|
||||
|
||||
check_unsigned func() i32 {
|
||||
n u32 = 100
|
||||
n u32 := 100
|
||||
n = divtrunc!(n, 7) # 14
|
||||
n -= 4 # 10
|
||||
if n == 10 {
|
||||
@@ -23,7 +23,7 @@ check_unsigned func() i32 {
|
||||
}
|
||||
|
||||
main func() i32 {
|
||||
total i32 = 0
|
||||
total i32 := 0
|
||||
total += 10 # 10
|
||||
total -= 3 # 7
|
||||
total *= 4 # 28
|
||||
@@ -33,7 +33,7 @@ main func() i32 {
|
||||
total = total + 2 * 3 - 4
|
||||
|
||||
# compound assignment as a while-loop update
|
||||
i i32 = 0
|
||||
i i32 := 0
|
||||
while i < 5 : i += 1 {
|
||||
total += 1 # +5 => 21
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user