Ruby Ruby Basics Strings Escape Sequences

Saadia Fattah
Saadia Fattah
1,939 Points

How do you make these escape sequences work?

It keeps on saying Bummer: (eval):3: unterminated regexp meets end of file (eval):3: syntax error, unexpected tSTRING_END, expecting tSTRING_CONTENT or tREGEXP_END or tSTRING_DBEG or tSTRING_DVAR

program.rb
puts  "cats/n"
puts  "cats/t"
puts  /"cats"

2 Answers

Rogier Nitschelm
Rogier Nitschelm
iOS Development Techdegree Student 5,460 Points

Hello there,

Two suggestions from me. Remember that an escape sequence uses a backslash:

puts "cats/n" # this does not work unfortunately. 
puts "cats\n" # you should try something like this instead

The same goes for escaping a double quote:

puts /"cats" # this does not work
puts "\"cats"  # this does however

So remember, always use a backslash when escaping \.