'elseif'还存在吗? [英] Does 'elseif' still exist?

查看:140
本文介绍了'elseif'还存在吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚学习ROR,我遇到了if / else语句。我也遇到了'elseif',但是我的文本编辑器(textmate)不会将其作为关键字选择,程序也不能正常运行。

I'm just learning ROR and I came across the if / else statements. I also came across 'elseif' but my text editor (textmate) doesn't pick it up as a keyword, nor does the program run properly.

if name == 'Chris'
  puts 'What a lovely name.'
elseif name == 'Katy'
  puts 'What a lovely name!'
end

我正在使用几年前写的学习计划一书。我想知道'elseif'是否被更改,因为当我只是使用'else'时,它似乎正常运行。

I'm using the book Learn to Program, which was written several years ago. I was wondering if the 'elseif' was changed because, when I simply use 'else', it seems to function properly.

推荐答案

这是 elsif ,而不是 elseif

略有混淆当你是新人时,可能。

Slightly confusing when you're new, probably.

这篇关于'elseif'还存在吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆