Course of Raku / Essentials / Strings / Escaping special characters

Quiz: A backslash in the output

From the below strings, check those that will have precisely one backslash \ in the output if you print them.

0 "Level\n\t2"  
0 "Level\n\nTwo"  
1 'Storey\nTwo'  
1 'Tab is \t'  
0 "Using a tab\there"  
1 "//\\" The output is //\
1 '//\\' One backslash escapes the other here: //\.
1 '\"' No escaping here, the string appears as is: \".

Comments

The main thing to look at here is the quotes. They determine the way the \-prefixed characters are escaped.

Course navigation

Strings / Code interpolation   |   Strings / String length


💪 Or jump directly to the exercises to this section.