Ascertaining!
Paul Backus
snarwin at gmail.com
Sat Jul 9 11:22:45 UTC 2022
On Saturday, 9 July 2022 at 10:12:00 UTC, Salih Dincer wrote:
> Hi All,
>
> I didn't know compiling was bottom-up. This example proves
> that. Because in single-line expressions, it takes value from
> the right, firstly.
>
> ```d
> void main()
> {
> int n; // true (n == 0)
> int i = 1; // true (i == 1)
> int j = i = n; // all numbers are 0
> ```
Yes, [the `=` operator is right-associative][1] in pretty much
all C-like languages, so an expression of the form `a = b = c` is
equivalent to `a = (b = c)`.
[1]:
https://en.wikipedia.org/wiki/Operator_associativity#Right-associativity_of_assignment_operators
More information about the Digitalmars-d-learn
mailing list