^^Variabili; programmazione informatica. Incrementare una variabile.

 

Incrementare una variabile

x += 20      e' istruzione di somma e assegnazione. Incrementa var x di 20.
x = x + 20   e' equivalente.

Incremento di 1

x += 1      e' istruzione di somma e assegnazione. Incrementa var x di 1.
x = x + 1   e' equivalente
x++         e' equivalente.

Local variables

One reason not to use locals is that Chuck Moore hates them: my-history-with-forth-stack-machines.html

I remain adamant that local variables are not only useless, they are harmful.

If you are writing code that needs them you are writing non-optimal code. Don’t use local variables. Don’t come up with new syntax for describing them and new schemes for implementing them. You can make local variables very efficient especially if you have local registers to store them in, but don’t. It’s bad. It’s wrong.

It is necessary to have [global] variables. … I don’t see any use for [local] variables which are accessed instantaneously.