Console: WriteLine

WriteLine

Writes a value to the current output stream.



 Public Sub WriteLine(
	  ParamArray Values ( ) As Variant )

Parameters

Values
[ByRef] Variant. A set of zero or more parameters used to create a formatted string output.

Remarks

The first parameter is the string that will be written to the current output stream. All additional parameters will be used as formatting information in the first parameter. If no parameters are provided, then an empty string is written with a NewLine.

Examples

The following example demonstrates how to write output to the console using the WriteLine method. There are 3 ways to use the WriteLine method effectively, and they are shown below.

Private Sub Main()
    ' writes a NewLine to the console
    Console.WriteLine
    
    ' writes a string followed by a NewLine
    Console.WriteLine "Hello"
    
    ' writes a formatted string using the
    ' supplied parameters, followed by a NewLine
    Console.WriteLine "Hello, {0}", "Kelly"
    
    Console.WriteLine "Press Return"
    Console.ReadLine    ' waits for return key to continue
End Sub

' This example produces the following output.
' (Blank Line)
' Hello
' Hello, Kelly
' Press Return
As you can see, the WriteLine method accepts a variaty of parameters to create differently formatted outputs to the Console. The first parameter is the string to be written to the console, while any additional parameters are used by formatting information within the first parameter.

See Also

Project CorLib Overview

Class Console Overview