assignment operator(=) does not find a place in the list of operators

13 views
Skip to first unread message

sekaran6

unread,
Aug 15, 2012, 1:34:12 AM8/15/12
to loop...@googlegroups.com

"The following operators are provided by loop:" +, -, /, *, %, >, <, >=, <=, ==, not, and, or.  But I can't find the assignment operator =  in this.Documentation reads "no loop operator ever mutates its operands. It simply reads and combines them to produce a third, resultant value. (the assign operator is an exception, but we'll deal with that later)."

Can you please throw more light on the issue ?


Dhanji R. Prasanna

unread,
Aug 15, 2012, 1:38:40 AM8/15/12
to loop...@googlegroups.com
The data structures section has some detailed examples of assignments:

Also the local scope section:

What exactly are you looking for?
Message has been deleted

sekaran6

unread,
Aug 15, 2012, 4:25:38 AM8/15/12
to loop...@googlegroups.com
Thank you for kind clarification.I wanted to know whether a statement like x = x + 1 which is valid in other languages is possible in loop.I find such a statement to raise compile time exception.Is it connected with immutability in Loop ; something akin to val as against var in Scala ?

Dhanji R. Prasanna

unread,
Aug 15, 2012, 5:21:45 AM8/15/12
to loop...@googlegroups.com
You can do this inside a function. We are changing the syntax a bit from:

main ->
  x = x + 1
  where
    x = 1

to:

main ->
  x = 1
  x = x + 1

It depends if you are using the downloaded binary or building from source (newer syntax).
Reply all
Reply to author
Forward
0 new messages