你会认为这是一个简单的问题,但我在任何地方都找不到答案.>_<
You would think that this would be an easy question, but I can't find the answer anywhere. >_<
如果我的代码缩进不正确,Ruby 会抛出语法错误吗?例如,这样的代码会起作用吗?
Will Ruby throw syntax errors if my code is indented incorrectly? For example, would code like this work?
if str.blank? str = "Hello World" no_input = true end显然,这是不好的风格,无论如何我都应该正确缩进.我想知道我是否可以排除它作为调试会话期间错误的原因.
Obviously, this is bad style and I should indent correctly regardless. I want to know whether I can rule it out as the cause of a bug during debugging sessions.
推荐答案是的,它会起作用.Ruby 只查找换行符.
Yes, it would work. Ruby only looks for the line breaks.
但由于代码可读性也非常重要,因此我认为您应该注意空格.
But since code readability is also very important, I'd say you should take care of whitespace if only for that sake.
更多推荐
我需要在 Ruby 中缩进我的代码吗?
发布评论