The test for chained assignment was incorrectly printing variable `a` twice instead of printing `b` for the second assertion. This fix changes the second `System.print(a)` to `System.print(b)` so the test correctly verifies that both `a` and `b` hold the value "chain" after the chained assignment `a = b = "chain"`.
12 lines
244 B
Plaintext
12 lines
244 B
Plaintext
// Chained assignment.
|
|
var a = "a"
|
|
var b = "b"
|
|
a = b = "chain"
|
|
System.print(a) // expect: chain
|
|
System.print(b) // expect: chain
|
|
|
|
// Assignment on RHS of variable.
|
|
var c = a = "var"
|
|
System.print(a) // expect: var
|
|
System.print(c) // expect: var
|