Module Module1
Sub Main()
Dim snom, avg As String
Console.WriteLine("The WriteLine method uses placeholders to hold a value.")
Console.WriteLine("Placeholders start with 0 enclosed within curly braces.")
Console.WriteLine("A value is placed after the string following a comma.")
Console.WriteLine("The value replaces the string in the display.")
Console.WriteLine() 'skips a line
Console.ReadLine() 'waits for user to press Enter
Console.WriteLine("Values may be strings, numbers, variables, or expressions.")
Console.WriteLine("My name is {0}.", "George")
Console.WriteLine("I passed the {0} test.", "math")
Console.WriteLine("My average was {0}.", 85)
Console.ReadLine() 'waits for user to press Enter
Console.Clear() 'clears the screen
Console.WriteLine("Number expressions that are not strings can be computed.")
Console.WriteLine("The computed results are copied to the placeholders.")
Console.WriteLine("5 + 3 is {0}.", "5 + 3")
Console.WriteLine("5 + 3 is {0}.", 5 + 3)
Console.WriteLine() 'skips a line
Console.ReadLine() 'waits for user to press Enter
Console.WriteLine("More than one placeholder can be used.")
Console.WriteLine("The placeholders are numbered in order beginning with 0.")
Console.WriteLine("There must be the same number of values following the comma.")
Console.WriteLine("The values must be in the same order as the placeholder numbers.")
Console.WriteLine() 'skips a line
Console.WriteLine("{0} has an average of {1}.", "George", 85)
Console.WriteLine("His test scores were {0}, {1}, and {2}.", 75, 92, 88)
Console.WriteLine("His average is {0}.", ((75 + 92 + 88) / 3)) 'uses an expression
Console.WriteLine() 'skips a line
Console.ReadLine() 'waits for user to press Enter
Console.WriteLine("Placeholder values can be repeated by using the same number.")
Console.WriteLine("The box has room for {0} items and I have all {0}.", 12)
Console.WriteLine("The box has room for {0} {1} and I have all {0}.", 12, "eggs")
Console.WriteLine() 'skips a line
Console.ReadLine() 'waits for user to press Enter
Console.WriteLine("Variables may be used with placeholders.")
snom = "George"
avg = "85"
Console.WriteLine("{0} has an average of {1}.", snom, avg)
Console.ReadLine()
End Sub
End Module