charly-lang / charly

🐈 The Charly Programming Language | Written by @KCreate
https://charly-lang.github.io/charly/
MIT License
199 stars 10 forks source link

`++` and `--` postfix operators #59

Closed KCreate closed 8 years ago

KCreate commented 8 years ago

Allows to write these things:

let a = 25;
a++;
a # => 26
a--;
a # => 25
KCreate commented 8 years ago

Default behaviour is a syntax rewrite to:

let a = 25;
a++;

# would become:
a = a + 1;

If the identifier or literal is not a numeric literal, the interpreter will search for a method called __pplus or __pminus respectively. An error is thrown if nothing is found.

KCreate commented 8 years ago

Closed in favor of #57