Difference between revisions of "ScriptBasic:UsersGuide 9.12"

From ScriptBasic
Jump to: navigation, search
(New page: [Contents]<br /> :9. General Language Format<br /> =9.12. Operator Assignments= [<<<] [[ScriptBasi...)
 
(No difference)

Latest revision as of 21:05, 28 December 2007

[Contents]

9. General Language Format

9.12. Operator Assignments

[<<<] [>>>]


Most of the times we assign the value of an expression to a variable, which uses the variable itself. For example


A = A + 1

increments the variable A. To ease programming ScriptBasic allows the construct


A += expression

instead of


A = A + expression

This is a well known and widely used form by many languages, well readable, though not BASIC like. Likewise programmers can write


A -= expression instead of A = A - expression
A *= expression instead of A = A * expression
A /= expression instead of A = A / expression
A \= expression instead of A = A \ expression
A &= expression instead of A = A & expression

This is more readable for most of the programmers and results slightly faster execution for addition, subtraction, multiplication, division, integer division and string concatenation respectively.


[<<<] [>>>]