Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用变量 insite %w{} 但这只会生成字符串。
我试过了
a="hello", b="world" %w{a b}
但这是 ["a", "b"]我要显示的显示 ["hello","world"]
["a", "b"]
如果要使用变量,可以使用插值和%W变体
%W
a = "hello" b = "world" pp %W{#{a} #{b} this is normal text} #=> ["hello", "world", "this", "is", "normal", "text"]