#关键字
=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
关键字
最新推荐文章于 2022-02-25 18:19:43 发布