内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用
在Ruby 1.9.1中,如果
$VERBOSE = true
puts /m/ , 42.to_s
或者
$VERBOSE = true
puts /m/ , "42"
会收到警告
warning: ambiguous first argument; put parentheses or even spaces
但如果这样做
$VERBOSE = true
puts "m" , 42.to_s
或者
$VERBOSE = true
puts(/m/, 42.to_s)
都没有问题。