Ruby 注释
Ruby 教程
· 2019-02-18 23:29:05
注释是在运行时会被忽略的 Ruby 代码内的注释行。单行注释以 # 字符开始,直到该行结束,如下所示:
实例
#!/usr/bin/ruby -w
# 这是一个单行注释。
puts "Hello, Ruby!"
当执行时,上面的程序会产生以下结果:
Hello, Ruby!
Ruby 多行注释
您可以使用 =begin 和 =end 语法注释多行,如下所示:
实例
#!/usr/bin/ruby -w
puts "Hello, Ruby!"
=begin
这是一个多行注释。
可扩展至任意数量的行。
但 =begin 和 =end 只能出现在第一行和最后一行。
=end
当执行时,上面的程序会产生以下结果:
Hello, Ruby!
请确保尾部的注释离代码有足够的距离,以便容易区分注释和代码。如果尾部超过一条注释,请将它们对齐。例如:
实例
@counter # 跟踪页面被点击的次数
@siteCounter # 跟踪所有页面被点击的次数
点击查看所有 Ruby 教程 文章: https://www.codercto.com/courses/l/16.html
Getting Started with C++ Audio Programming for Game Development
David Gouveia
Written specifically to help C++ developers add audio to their games from scratch, this book gives a clear introduction to the concepts and practical application of audio programming using the FMOD li......一起来看看 《Getting Started with C++ Audio Programming for Game Development》 这本书的介绍吧!