Repository navigation
Operator Subtract
Home › Operators › Operator - (Subtract)
Subtracts two expressions
Declare Operator - ( ByRef lhs As Integer, ByRef rhs As Integer ) As Integer
Declare Operator - ( ByRef lhs As UInteger, ByRef rhs As UInteger ) As UInteger
Declare Operator - ( ByRef lhs As Single, ByRef rhs As Single ) As Single
Declare Operator - ( ByRef lhs As Double, ByRef rhs As Double ) As Double
Declare Operator - ( ByRef lhs As T Pointer, ByRef rhs As T Pointer ) As Integer
Declare Operator - ( ByRef lhs As T Pointer, ByRef rhs As Integer ) As T Pointer
Declare Operator - ( ByRef lhs As T, ByRef rhs As T ) As Integer
Declare Operator - ( ByRef lhs As T, ByRef rhs As Integer ) As TlhsrhsT
When the left and right-hand side expressions are numeric values, Operator - (Subtract) returns the subtraction of the two values.
If the left and right-hand side expressions are both of the T Pointer type, for some type T, the operator performs pointer subtraction on the address, returning the result. This is different from numeric subtraction because the difference is divided by SizeOf( T ).
If an integral value n is subtracted from a T Pointer type, the operator performs pointer arithmetic on the address, returning the memory position of a T value, n indices before (assuming (-n) is within bounds of a contiguous array of T values). This behaves differently from numeric subtraction, because the Integer value is scaled by SizeOf( T ).
Neither operand is modified in any way.
This operator can be overloaded to accept user-defined types.
Returns the subtraction of two expressions.
result = lhs-rhs
- In the -lang qb dialect, this operator cannot be overloaded.
- None
Dim n As Single
n = 4 - 5
Print nwill produce the output:
-1Category: Operators
Kind: operator
Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing