Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Strings basics
3. Escape sequences – practice
Regular expressions
Modifying strings
Summary

Instruction

Good! Now it's time that you write your own string with escape sequences. Here's the table with common escape sequences to help you out:

\" For escaping the double quote characters when they are used as string delimiters.
\' For escaping the single quote characters when they are used as string delimiters.
\n For escaping the newline character.
\t For escaping the tab character.
\\ When we want to use the backslash character. This will be extremely necessary later in the course.

Exercise

Save to the string variable the following text:

Here's a single quote: '
Here's a double quote: "
Here's a backslash: \
	And this line is indented by a tab.

Stuck? Here's a hint!

Here's one of the correct answers:

string <- "Here's a single quote: '\nHere's a double quote: \"\nHere's a backslash: \\\n\tAnd this line is indented by a tab."