娃娃鸭学Ruby-注释

来源:互联网 发布:mac退出全屏预览 编辑:程序博客网 时间:2024/04/27 22:39

1、注释
注释以#字符开头并持续到该行结束
如果#字符出现在一个字符串或正则表达式字面量里,那么它将作为此字符串或正则表达式的一部分而非引入一段注释。
# This entire line is a comment
x="#This is a string"
y=/#This is a regular expression/
以上两个不是注释

2、嵌入式文档
多行注释风格。
以一个“=begin"开头,并以一个"=end"结尾("=end"所在的那一行也包括在内).

=begin 必须做为第一个开头

=begin Someone needs to fix the brokencode below!
  Any code here is commented out
=end

#=begin Someone needs to fix the brokencode below!
  The code that goes here is no longer commented out
#=end
以上不为注释。
2011-3-28 21:06

原创粉丝点击