我正在寻找纯粹的语法相关推理。这不是一个关于红宝石应该用于美容或其他什么的问题。
not(['a','u','i','o','e'].include? s[0].downcase)
#this third line will error!
not ['a','u','i','o','e'].include? s[0].downcase
#you can also incorrectly represent this as
not['a','u','i','o','e'].include?(s[0].downcase)
#but correctly as this with the higher precedence !
!['a','u','i','o','e'].include?(s[0].downcase)
#but then again incorrectly as
!['a','u','i','o','e'].include? s[0].downcase
一般来说,我认为带有(),{},;,\ n和end的空格很难在ruby中得到正确的结果。它与优先权有关。有人可以在执行上面的代码时向我展示这些不可见()的位置和映射。