Title here
Summary here
Our first program will print the classic “hello world” message. Here’s the full source code.
Module HelloWorld
Sub Main()
Console.WriteLine("hello world")
End Sub
End Module
To run the program, save the code in HelloWorld.vb
and use the Visual Basic command-line compiler.
$ vbc HelloWorld.vb
$ HelloWorld
hello world
Sometimes we’ll want to build our programs into executables. Visual Basic can compile the code directly into a .exe
file.
After running the vbc
command, you will have an executable named HelloWorld.exe
:
$ vbc HelloWorld.vb
$ ls
HelloWorld.exe HelloWorld.vb
We can then execute the built executable directly.
$ ./HelloWorld.exe
hello world
Now that we can run and build basic Visual Basic programs, let’s learn more about the language.