Lately, I’ve been targeting newer open-source languages, but I just have to veer off course a little today. That’s because Sample Programs in Every Language got it’s first GitHub contributor, Aaron Lenoir. Thanks to Aaron, we’re able to share Hello World in Visual Basic .NET.
Table of Contents
Visual Basic .NET Background
According to Wikipedia, Visual Basic .NET (VB.NET) is a programming language that was created by Microsoft in 2001. Beyond that, Wikipedia doesn’t have much to offer in terms of historical information, so let’s move on.
In terms of features, however, Wikipedia has a little more to offer. For instance, VB.NET is statically typed, but the type system is both strong and weak as well as safe and unsafe.
As for syntax, VB.NET is structured which reminds me of languages like Pascal and MATLAB where blocks of code are marked by keywords—rather than braces or whitespace.
Beyond that, VB.NET has several versions. In fact, VB.NET only really refers to the language before 2005, but the syntax is largely the same today. Of course, I’ve sort of lumped them together in the same way I’ve recognized Python as one language instead of two.
Hello World in Visual Basic .NET
At any rate, let’s dive right into Hello World in Visual Basic .NET:
Public Module HelloWorld Public Sub Main() System.Console.WriteLine("Hello, World!") End Sub End Module
As we can see, VB.NET is a structured language. In other words, there’s a very strong focus on code blocks and control flow structures.
Our first code block is the module declaration. In this case, we’ve declared a public module called HelloWorld. If other libraries needed access to this module, they could simply import it by name.
Next, we have our typical main function declaration. Of course, in VB.NET, we call them subroutines rather than functions—as indicated by the Sub keyword.
Finally, we have our print line. Much like languages like Java, we have to string together a few references before we can actually write to the console. In other words, we have to call WriteLine after we get a reference to the standard output class from the System namespace.
How to Run the Solution
With our solution implemented, we should probably give it a run. Perhaps the easiest way to run the solution is to copy it into an online VB.NET compiler.
Alternatively, we can run the solution using Microsoft’s very own Visual Studio. Of course, I’m not sure of it’s support on platforms beyond Windows. Don’t forget to grab a copy of the Hello World in Visual Basic .NET solution.
Sample Programs in Every Language
Well, I suppose that’s it for this article. Again, thanks for swinging by, and a special thanks to Aaron Lenoir for their contribution.
If you enjoyed this article, consider giving it a share. And if you really liked this article, why not contribute to the project? We can always use more help!
As for what’s next, I don’t have any plans. Obviously, there are a ton of code snippets without articles, so I’ve been tackling them one at a time.
Chiropractors get a bad rap, but I find their YouTube content somewhat enjoyable. That said, they absolutely destroyed my YouTube recommendations.
Python is a fun language to learn on its own, but what if we could learn it by doing something even more fun like making Discord bots?