Skip to content

Commit

Permalink
[doc] Update/remove place mutation examples
Browse files Browse the repository at this point in the history
Oil only has arrays and dicts, not records.

Thanks to feedback from hxka on Reddit
  • Loading branch information
Andy C committed May 11, 2021
1 parent e1d4226 commit d11f2c2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions doc/variables.md
Expand Up @@ -251,12 +251,17 @@ The expression to the left of `=` is called a **place**. These are basically
Python or JavaScript expressions, except that you add the `setvar` or
`setglobal` keyword.

setvar x[1] = 2
setvar d['key'] = 3
setvar x[1] = 2 # array element
setvar d['key'] = 3 # dict element
setvar d->key = 3 # syntactic sugar for the above
setvar func_returning_list()[3] = 3
setvar x, y = y, x # swap

<!--
Note: these may be valid in Tea, but not Oil
setvar func_returning_list()[3] = 3
setvar x.foo, x.bar = foo, bar
-->

### Syntactic Sugar: Omit `const`

Expand Down

0 comments on commit d11f2c2

Please sign in to comment.