我正在做Zed的“艰难地学习Ruby”的练习24,并且遇到了一个问题。有一点是他让我们输入的:
poem = <<END
\tThe lovely world
with logic so firmly planted
cannot discern \n the needs of love
nor comprehend the passion from intuition
and requires an explanation
\n\t\twhere there is none.
END
puts "-------------"
puts poem
puts "-------------"我的代码就是这么做的:
-------------
The lovely world
with logic so firmly planted
cannot discern
the needs of love
nor comprehend the passion from intuition
and requires an explanation
where there is none.
---------------My‘可爱’行加了两次标签。我也认为我的台词“哪里没有”。可能也太远了..。
我在某个地方找了个额外的地方。在"<<END“之后,在第一个和第二个”-----“之后。我取消了该选项卡,以查看它是否会选择w/o选项卡,但它没有。我在与<<END相同的行中使用了一个\n\t,只是看看它是否有效,但我得到了一条错误消息。有人知道怎么回事吗?以及如何修复??
编辑:我正在使用Ubuntu14.04,这是我的屏幕截图screenshot2
希望这对你(和我)有帮助。
我只是意识到我还没有展示他说的应该是什么样子,就这样。screenshot3
发布于 2015-10-25 21:57:04
它可能只是你的终端输出标签相当广泛,作为8个空格。尝试一些更简单的选项卡宽度,如下所示:
puts "tab\twidth"
puts "tab........width"您可以将终端中的选项卡宽度更改为4个空格。
tabs 4您也可以查看您的终端的手册页或设置。
https://stackoverflow.com/questions/33335455
复制相似问题