+: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary Tags: Undo Reverted |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
The '''+''' plus mathematical operator performs addition on two numerical values or [[concatenation|concatenate]] [[STRING]] values. | The '''+''' plus mathematical operator performs addition on two numerical values or [[concatenation|concatenate]] [[STRING]] values. | ||
{{PageSyntax}} | |||
: {{Parameter|return_value}} = {{Parameter|number1}} [[+]] {{Parameter|number2}} | |||
{{PageDescription}} | {{PageDescription}} | ||
* A [[+]] sign also can indicate a positive numerical value, but it is not required. | * A [[+]] sign also can indicate a positive numerical value, but it is not required. | ||
* Numbers used can be any literal or variable numerical value type. | * Numbers used can be any literal or variable numerical value type. | ||
* Adding one negative value will actually perform subtraction on the other value. | * Adding one negative value will actually perform subtraction on the other value. | ||
* Adding two negative values will make the return value more negative. | * Adding two negative values will make the return value more negative. | ||
* Addition and subtraction are the last operations performed in QBasic's normal order of operations. | * Addition and subtraction are the last operations performed in QBasic's normal order of operations. | ||
* The [[+|plus(+)]] operator can also be used to add ([[concatenation|concatenate]]) literal or variable [[STRING]] values. | * The [[+|plus(+)]] operator can also be used to add ([[concatenation|concatenate]]) literal or variable [[STRING]] values. | ||
* [[PRINT]] can also use + operations on string values ONLY! Numerical values will need to be converted to strings first or be included using [[semicolon]]s or [[comma]]s instead. | * [[PRINT]] can also use + operations on string values ONLY! Numerical values will need to be converted to strings first or be included using [[semicolon]]s or [[comma]]s instead. | ||
{{PageSeeAlso}} | |||
* [[-|- minus]] (subtraction or [[negation]] operator) | |||
* [[Mathematical Operations]] | |||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 22:30, 31 January 2023
The + plus mathematical operator performs addition on two numerical values or concatenate STRING values.
Syntax
- return_value = number1 + number2
Description
- A + sign also can indicate a positive numerical value, but it is not required.
- Numbers used can be any literal or variable numerical value type.
- Adding one negative value will actually perform subtraction on the other value.
- Adding two negative values will make the return value more negative.
- Addition and subtraction are the last operations performed in QBasic's normal order of operations.
- The plus(+) operator can also be used to add (concatenate) literal or variable STRING values.
- PRINT can also use + operations on string values ONLY! Numerical values will need to be converted to strings first or be included using semicolons or commas instead.
See also
- - minus (subtraction or negation operator)
- Mathematical Operations