Author |
Topic: Compound assignment operators (Read 335 times) |
|
Alincon
Full Member
member is offline
Posts: 147
|
|
Compound assignment operators
« Thread started on: Nov 6th, 2016, 11:22pm » |
|
"Compound assignment operators (+=. ‑=, *=, /=) are provided. "
I would like to see some examples of using Compound assignment operators: what does += do?
Thanks r.m.
|
|
Logged
|
|
|
|
tsh73
Full Member
member is offline
Gender:
Posts: 210
|
|
Re: Compound assignment operators
« Reply #1 on: Nov 7th, 2016, 06:51am » |
|
Well, instead of Code:you write Code:. And instantly make your code uncompatible with majority of BASIC's. (You may not care actually - one always code "here" and "now")
|
« Last Edit: Nov 7th, 2016, 06:53am by tsh73 » |
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: Compound assignment operators
« Reply #2 on: Nov 7th, 2016, 08:21am » |
|
on Nov 7th, 2016, 06:51am, tsh73 wrote:And instantly make your code uncompatible with majority of BASIC's. |
|
Visual BASIC has them, BBC BASIC has them, PowerBASIC has them.... (and of course they're ubiquitous in most other programming languages like C++, Java, Python etc.).
Also bear in mind that the compound assignment operators aren't just faster to write, they execute more quickly too.
Richard.
|
|
Logged
|
|
|
|
tsh73
Full Member
member is offline
Gender:
Posts: 210
|
|
Re: Compound assignment operators
« Reply #3 on: Nov 7th, 2016, 09:16am » |
|
Quote: I was not aware ot this, indeed.
|
|
Logged
|
|
|
|
|