A simple introduction to Visual Basic and how it works.
Visual Basic (VB) is a programming language created by Microsoft. It is known for being easy to learn, especially for beginners. Visual Basic lets you create Windows applications using simple, readable English-like commands.
Here is a simple example written in VB.NET that prints a message on the screen:
Imports System
Module Program
Sub Main()
Console.WriteLine("Hello, Visual Basic!")
End Sub
End Module
Module Program
Sub Main()
Dim a As Integer = 5
Dim b As Integer = 3
Dim result As Integer = a + b
Console.WriteLine("The result is: " & result)
End Sub
End Module
Module Program
Sub Main()
Dim age As Integer = 16
If age >= 18 Then
Console.WriteLine("You are an adult.")
Else
Console.WriteLine("You are a minor.")
End If
End Sub
End Module
Module Program
Sub Main()
Dim fruits() As String = {"Apple", "Banana", "Cherry"}
For Each fruit In fruits
Console.WriteLine("Fruit: " & fruit)
Next
End Sub
End Module
Module Program
Function AddNumbers(a As Integer, b As Integer) As Integer
Return a + b
End Function
Sub Main()
Dim result As Integer = AddNumbers(4, 6)
Console.WriteLine("The total is: " & result)
End Sub
End Module