I have been doing a great deal of C programming lately, but at work I wrote an ICS "smart diff" in Icon. Well, the following lines made me waste over an hour!
I thought I was going nuts -- until it dawned on me that the first/*if find (oldstring, line) then break */ if find(newstring, line) then breakfind()
was getting executed! (Then I realized I was using the C not the Icon style comment.)
if
find()
... expression is null and multiplies
that by the result of the second if
find()
...
expression if it is null.Suppose, for concreteness, thax1 :=: x2 :=: x3 :=: :=: xn
before the expression above is evaluated. What are their values afterwards? Why? And can you think of a practical use for this kind of thing?x1 = 1
,x2 = 2
,x3 = 3
,xn = n