Visual Basic 2008 9.0 .NET Examples and Ebook

Introduction to Visual Basic

Vorig Onderwerp

New in Visual Basic 2008 - 9.0

|

Arrays

Volgend Onderwerp

Some Operators

Vorig Onderwerp

Variables

|

Reading Input from the User

Volgend Onderwerp
Arithmetical Operators

Arithmetical Operators

Concatenation Operator

Concatenation Operator

Nextline Operator

Nextline Operator

Multiple Declarations

Multiple Declarations



Next example will print two values and their sum.


Module Example
    Sub Main()
        Dim value1 As Integer
        Dim value2 As Integer
        Dim sum As Integer
        value1 = 1
        value2 = 2
        sum = value1 + value2
        '
        ' or :
        ' Dim value1 As Integer = 1
        ' Dim value2 As Integer = 2
        ' Dim sum As Integer = value1 + value2
        '
        ' or :
        ' Dim value1 As Integer = 1, value2 As Integer = 2, _
        '     sum As Integer = value1 + value2
        '
        Console.WriteLine(value1 & " + " & value2 & _
                          " = " & sum)
        '
        Console.ReadLine()
    End Sub
End Module
Download Broncode

Output :

 1 + 2 = 3

Arithmetical Operators


The above example illustrates the use of the addition operator +.

Other arithmetical operators are :
- subtraction operator -
- multiplication operator *
- division operator /
- integral division operator \
- modulo operator Mod
- exponential operator ^

All the above operators use two operands ( left and right operator ).


Klik hier om terug naar boven te gaan.  Up



Concatenation Operator


The concatenation operator & will combine two Strings ( to one String ).


Klik hier om terug naar boven te gaan.  Up



Nextline Operator


The nextline operator _ can be used to maintain readability of your code.
The compiler interprets the instruction on the line following an underscore as if it was on the position of that underscore.


Klik hier om terug naar boven te gaan.  Up


Multiple Declarations


A declaration line can contain more than one variable. After the type specifier ( of the declaration of some variable ) a comma is place, followed by the declaration of the next variable.





This version ( published on 2008-06-24 ) is printed from http://www.studyvb.com, visit the website for more recent information.

Updated On : 2008-01-21

Download Broncode

Published On : 2008-06-24

Some Operators

Vorig Onderwerp

Variables

|

Reading Input from the User

Volgend Onderwerp

Introduction to Visual Basic

Vorig Onderwerp

New in Visual Basic 2008 - 9.0

|

Arrays

Volgend Onderwerp
Nederlands  Nederlands

Add to favorites (IE).