The PrintN command takes one parameter, the string to be displayed in the console window. PrintN does not return a value. The string is displayed in the console window at the current position of the cursor. The cursor is then moved onto the next line, so that any text displayed after calling PrintN is shown at the start of the next line.
The Print command is very similar. It takes one parameter (a string) and returns no value. The string is displayed in the console window at the current position of the cursor. The cursor is updated to be at the end of the string which has just been printed, not on a new line.
Remember that to display numbers you first need to convert them to strings. This is done using the Str() and StrF() commands, as described in the Variables chapter.
This example illustrates the difference between PrintN and Print. You can get the source code here. The output of the program is shown below the example.
If OpenConsole()
Print("There will be no new line after this:")
Print("Told you!")
PrintN("Notice that the newline is put in after the string to be printed and not before it (this string is also on the end of the previous ones")
PrintN("This is on a new line")
PrintN("")
PrintN("That last command gave us a blank line (printing an empty string with a new line)")
PrintN("Press return to exit")
Input()
CloseConsole()
EndIf
End
| Previous topic | Chapter contents | Next topic |
|---|---|---|
| Creating text displays | User Guide contents | Reading values from the user |