Icon+Unicon/Intro: Difference between revisions
Content added Content deleted
(→Unary: format) |
m (→Binary (and Augmented): tidy up) |
||
Line 291: | Line 291: | ||
The operators above may be used in augmented form with normal assignment (i.e., x1 op:= x2; short for x1 := x1 op x2) . Many of these are common and natural, such as any of the mathematical group, concatenation, and comparisons for sorting. And the most common uses will be building results inside loops or scanning operations. Some of the examples include: |
The operators above may be used in augmented form with normal assignment (i.e., x1 op:= x2; short for x1 := x1 op x2) . Many of these are common and natural, such as any of the mathematical group, concatenation, and comparisons for sorting. And the most common uses will be building results inside loops or scanning operations. Some of the examples include: |
||
<lang Icon> |
<lang Icon> while x1 +:= x2 # accumulation |
||
while x1 +:= x2 # accumulation |
|||
while x1 *:= x2 # product |
while x1 *:= x2 # product |
||
while S1 ++= S2 # builds a set/cset |
while S1 ++= S2 # builds a set/cset |
||
Line 302: | Line 301: | ||
Some others are less obvious, such as: |
Some others are less obvious, such as: |
||
⚫ | |||
<lang Icon> |
|||
⚫ | |||
</lang> |
|||
Others are obscure or even a bit baffling, such as: |
Others are obscure or even a bit baffling, such as: |
||
⚫ | |||
</lang Icon> |
|||
⚫ | |||
s1 ==:= s2 # ensures arguments are both strings (assigns but no value change) |
s1 ==:= s2 # ensures arguments are both strings (assigns but no value change) |
||
n1 =:= n2 # numeric version of above |
n1 =:= n2 # numeric version of above |