学习红宝石。使用 Lynda.com。 data_set 未显示在终端上

发布于 2024-12-31 22:38:16 字数 403 浏览 4 评论 0原文

我知道标题非常模糊,我很抱歉。我正在使用 Lynda.com 来学习 Ruby,并在 Ubuntu 11.10 上使用 1.9.2。

反正。在学习本教程时,我购买了示例文件以供参考。

在本教程的数组部分之后,它告诉我输入内容,我期望他得到相同的答案。然而……

我不这么认为。

如果你看一下屏幕截图,它们并不相同。视频在左侧,终端在右上角,示例文件在右下角。我没有得到预期的结果。我已经检查了终端设置,但没有看到任何遗漏的内容。请指教。

另外,我无法发布图片,因为我的帖子数量低于 10 个。请复制并粘贴链接。

https://i.sstatic.net/p51K0.png

I understand that the title was very vague and my apologies. I am using Lynda.com to learn Ruby and am using 1.9.2 on Ubuntu 11.10.

Anyway. While following this tutorial I have purchased the example files for reference.

Following the Arrays section of this tutorial it tells me to type in stuff, and I'm to expect the same answer he gets. However.....

I don't.

If you look at the screenshot they are not the same. Video is on the left, terminal is on the top right, the example file is on the bottom right. I am not getting the expected results. I have checked in the terminal settings and I don't see anything that I'm missing. Please advise.

Also, I cannot post images because I am below 10 posts. Please copy and paste the link.

https://i.sstatic.net/p51K0.png

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事未完 2025-01-07 22:38:16

在此处输入图像描述您正在测试代码的 irb 中存在拼写错误。应该是:

irb> data_set = []
irb> data_set = ["a","b","c"]

但是您将其错误地输入为 data_set['a","b","c"] 这就是它混乱的原因。请注意,您已附上 a 在错误的引号中。请参阅我的图像(ruby 1.9.2,Win 7)

enter image description hereThere is a typo in the irb where you are testing the code. It should have been:

irb> data_set = []
irb> data_set = ["a","b","c"]

but you have mistyped it as data_set['a","b","c"] thats why its messing up. Notice that you have enclosed a in wrong set of quotes. See my image (ruby 1.9.2, Win 7)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文