【问题标题】:How to add a line in code for ruby [duplicate]如何在代码中为ruby添加一行[重复]
【发布时间】:2016-06-19 07:01:19
【问题描述】:

我很抱歉,我确信答案就在那里,但我无法很好地表达它以供谷歌搜索..

给定一段很长的代码

puts 'This is a really long line of ruby code here'

你怎么能把它分成两行,即

puts 'This is a really long
      line of ruby code here'

【问题讨论】:

    标签: ruby


    【解决方案1】:
    str = 'first line'\
      ' second line'\
      ' third line'
    
    puts str
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-20
      • 2021-09-11
      相关资源
      最近更新 更多