Console: WriteValue |
Writes a string to the Console output stream without a NewLine break.
Public Sub WriteValue( ByRef Value As Variant, ParamArray Args ( ) As Variant )
Values are converted to their string representation for text output. A formatted output can be created similar to cString.Format.
In this example, the WriteValue function is used to display a sequence of values. The values are all written to the same line because WriteValue does not include a NewLine character after writing a value. A NewLine character has to be manually added to advance to the next line.
Private Sub Main() Dim i As Long ' Writes out a sequence of digits. The digits are written on the same line. Console.WriteValue "Loop 1: " For i = 1 To 5 Console.WriteValue i Next i ' Writes out a new line manually. Console.WriteValue vbCrLf ' Writes formatted values on the same line. Console.WriteValue "Loop 2: " For i = 1 To 5 Console.WriteValue "i = {0}" & IIf(i < 5, ", ", ""), i Next i End Sub ' This example produces the following output. ' Loop 1: 12345 ' Loop 2: i = 1, i = 2, i = 3, i = 4, i = 5