【发布时间】:2021-10-29 08:17:00
【问题描述】:
我是 Ruby 的初学者。有人可以帮我解决这个问题吗? 我想在“”中调用一个方法
def callme
"this string" # this is usually a path that I want to source from a single location
end
v= "string + callme "
如何在这里用引号调用函数?引号对我的代码至关重要。
【问题讨论】:
-
当你说“引号对我的代码很重要”时你能解释一下吗?预期结果是
"string + this string"或"string this string"还是"string + \"this string\""等,目前还不清楚。顺便说一句,作为一个小的语法建议,ruby 中没有 functions,只有 methods