Step 1 of 5 · Reading · ~1 min
Learn
Basics
VB.Net was released in 2002 as Microsoft's modernization of Visual Basic 6 onto the .NET runtime. It compiles to the same IL as C# and uses the same standard library — the difference is syntax style (English-like vs. C-family).
Module Program
Sub Main()
Console.WriteLine("Hello, VB.Net!")
End Sub
End Module
Module Name ... End Module— a static container for codeSub Main()— entry point.Sub(subroutine) returns nothing;Functionreturns a value- Statements end with newlines, NOT semicolons. Continuation:
_at end of line - Everything is case-insensitive —
console.writelineworks the same - Comments:
'(single quote) runs to the end of the line - Strings use
"only. A'never opens a string — it opens a comment, soConsole.WriteLine('hi')silently becomes a comment and prints nothing
Every executable line lives inside Sub Main. There are no top-level statements: text typed above Module Program is not output, it is parsed as code, and the compiler answers with error VBNC30203: Identifier expected.
Reading stdin: Console.ReadLine() returns a string. Convert with Integer.Parse(s), Double.Parse(s), or CInt(s).
A note on this course's compiler
The grader runs Mono's vbnc, a VB.NET 9-era compiler. It accepts everything above, but it predates two features you will meet in newer VB code: interpolated $"..." strings and lambda expressions (Function(x) x * 2). Lessons flag those where they come up; exercises never need them.
Your exercise
Replace the comment inside Sub Main with a Console.WriteLine call that prints the greeting. The most common way to fail this one is to type the expected output into the editor instead of the code that produces it — the editor holds a VB program, not a text file.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…