LB Booster
« Compound assignment operators »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:30am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Compound assignment operators  (Read 334 times)
Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx 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.
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Compound assignment operators
« Reply #1 on: Nov 7th, 2016, 06:51am »

Well, instead of Code:
counter = counter+1 
you write Code:
counter +=1 
.
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 » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Compound assignment operators
« Reply #3 on: Nov 7th, 2016, 09:16am »

Quote:
Visual BASIC has them,

I was not aware ot this, indeed.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls