加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 为什么我不能连接两个字符串并将它们分配给一个符号?

发布时间:2020-12-16 21:39:28 所属栏目:百科 来源:网络整理
导读:. . .如本例所示: helloworld.rb:1: syntax error,unexpected '=',expecting $end:helloworld = "hello ".concat("world") 我想如果我使用concat我修改字符串“hello”并添加“world”,然后最终将生成的字符串“hello world”分配给等号左侧的:helloworld
. . .如本例所示:
helloworld.rb:1: syntax error,unexpected '=',expecting $end
:helloworld = "hello ".concat("world")

我想如果我使用concat我修改字符串“hello”并添加“world”,然后最终将生成的字符串“hello world”分配给等号左侧的:helloworld符号.我认为这是合法的,就好像我写的那样:

:helloworld = "hello world"

哦,等等,这也不行. (划痕头).

解决方法

尝试这个:
:"hello world"

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读