# 与双引号括起的字符串一样,即其中的转义序列将被解释
# 结束标记前和后不能加空格
# 与单引号括起的字符串一样
# 结束标记后不能加空格
# 结束标记前能加空格
# 结束标记前和后不能加空格
ruby 代码
- str = <<eof span=""></eof> # 不中不能加'
- Once upon a midnight dreary, \\t
- While I pondered weak and weary, ... \\n
- EOF
- puts str
ruby 代码
- str = <<'EOF'
- This isn't a tab: \t
- and this isn't a newline: \n
- EOF
- puts str
# 结束标记前能加空格
ruby 代码
- str = <<-EOF
- Each of these lines
- starts with a pair
- of blank speces.
- EOF
- puts str
# 当中不能加"
ruby 代码
- ghg="""
- hkjhkjhk
- hkjhk
- """
- puts ghg
ruby 代码
- a = '''asdf
- asd
- fa
- sdf
- as
- df
- asdf'''
- puts a