that single quotes mean that their contents should be takenliterally, while double quotes mean that their contents should be interpreted. For example, the character sequence
\n
is a newline character when it appears in a string with double quotes, but is literally the two characters, backslash and n
, when it appears in single quotes.print "This string\nshows up on two lines."; print 'This string \n shows up on only one.';
(Two other useful backslash sequences are
\t
to insert a tab character, and \\
to insert a backslash into a double-quoted string.)
No comments:
Post a Comment