2008-04-21

关键字

#关键字
=begin
Ruby中的关键字如下:
模块定义:module
类定义: class
方法定义:def , undef
检查类型:defined?
条件语句:if , then , else , elsif ,case ,when ,unless
循环语句:for ,in ,while ,until ,next, break ,do ,
redo ,retry ,yield
逻辑判断:not ,and ,or
逻辑值和空值:true ,false , nil
异常处理:rescue ,ensure
对象引用:super ,self
块的起始:begin/end
嵌入模块:BEGIN ,END
文件相关:__FILE__ , __LINE__
方法返回:return
别名: alias
开源文档:Ruby 语言入门教程 v1.0
BEGIN模块相当于C语言中的宏, END模块用来作一些收尾工作。有了require,include,应该取消BEGIN和END的语法定义。
=end
评论
发表评论

您还没有登录,请登录后发表评论

weiweichen1985
搜索本博客
我的相册
E6c390da-d0cb-3350-97d4-83ec6586912c-thumb
2008-6-26
共 122 张
存档
最新评论