:= Documentation Clarification Topic is solved

Share your ideas as to how the documentation can be improved.
sirksel
Posts: 222
Joined: 12 Nov 2013, 23:48

:= Documentation Clarification

Post by sirksel » 29 Mar 2023, 15:43

I had an operator precedence question from a student, who was using && and || for flow control (i.e., to short-circuit fail before an assignment statement). This might be common and worth including more explicitly in the documentation of the assignment operator. It's covered by the not language already there, just not explicitly. Proposed new language in red:

"The precedence of the assignment operators is automatically raised when it would avoid a syntax error or provide more intuitive behavior. For example: not x:=y is evaluated as not (x:=y). Also, x==y && z:=1 is evaluated as x==y && (z:=1), which short-circuits when x doesn't equal y. Similarly, ++Var := X is evaluated as ++(Var := X); and Z>0 ? X:=2 : Y:=2 is evaluated as Z>0 ? (X:=2) : (Y:=2)."

lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: := Documentation Clarification

Post by lexikos » 30 Mar 2023, 01:53

I've moved this from the Bug Reports forum.

User avatar
Ragnar
Posts: 613
Joined: 30 Sep 2013, 15:25

Re: := Documentation Clarification  Topic is solved

Post by Ragnar » 13 Apr 2023, 04:37

Thanks for the suggestion. I've added it.

Post Reply

Return to “Suggestions on Documentation Improvements”