2.5.1 String Data Type

The first program in the previous paragraph used the data “Hello, World!” as the print statement’s parameter, a string data type. The value of the string data type begins and ends with double quotes. There is no limit for the length of the string.

print "Welcome to the Robot World."

A sequence beginning with a backslash (\) represents double quotes or special characters in a string. This sequence is called the “escape character.”

The supported escape characters are shown in the table below.

\"

Double quotes

\\

Backslash

\t

Tab

\n

New line character

print "Message:\nPlease, press \"OK\" button."

# Result of print
Message:
Please, press "OK" button.

Last updated

Was this helpful?