Public Module Program
Public Sub Main(args() As string)
Console.WriteLine("Hello, World!")
End Sub
End Module
Example
Dim byteVar As Byte
Dim intVar As Integer =100
Dim doubleVar As Double
Dim dateVar As Date
Dim charVar As Char ="A"
Dim strVar As String ="OneCompiler"
Dim boolVar As Boolean = TRUEt
Constants
[< attributeList >][ accessModifier ][ Shadows ] Const constantName [ As datatype ]= value
Dim variableName As String
Dim Name As String ="harismalik"
Conditional Statements
If condition-expression Then
'code
End If
If(conditional-expression)Then
'code if the conditional-expression is true
Else
'code if the conditional-expression is false
End If
If(conditional-expression)Then
'code if the above conditional-expression is true
Else If(conditional-expression) Then
'code if the above conditional-expression is true
Else
'code if the above conditional-expression is false
End If
If(conditional-expression)Then
'code if the above conditional-expression is trueIf(conditional-expression)Then
'code if the above conditional-expression is true
End If
End If
Select Cases
Select [ Case ] expression
[ Case expressionlist
'code ][ Case Else
'code ]
End Select
Loops
For..Next
For counter [ As datatype ]= begin To end [ Step step ]
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ counter ]
For..Each
It is used to concatenate two strings
For Each element [ As datatype ] In group
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ element ]
While
While conditional-expression
'Code
[ Continue While ]
'Code
[ Exit While ]
'Code
End While
DO -while
Do { While | Until } conditional-expression
'Code
[ Continue Do ]
'Code
[ Exit Do ]
'Code
Loop
Functions
Functions consists of a set of statements which perform a sepcific
functionality and they return a value when they are called.
[accessModifiers] Function functionName [(parameterList)] As returnType
'code
End Functioncode>
Sub-Procedures
Sub-procedures are similar to functions but they don't return any
value.