mus*_*dan 3 ruby comments slash
当我在Ruby的某些代码块的开头和结尾放置斜杠时,它们的行为就像注释。这是为什么?
码
puts "hello"
/
puts "world"
/
puts "peace"
Run Code Online (Sandbox Code Playgroud)
输出值
hello
peace
Run Code Online (Sandbox Code Playgroud)
您可以在此处创建多行正则表达式:
r = /
a
/
r.class
#=> Regexp
Run Code Online (Sandbox Code Playgroud)
在您的情况下,您首先放置hello,然后创建一个正则表达式
\\nputs "world"\\n
Run Code Online (Sandbox Code Playgroud)
然后你把 peace
| 归档时间: |
|
| 查看次数: |
38 次 |
| 最近记录: |