您的位置:首页 > 编程语言 > Ruby

[Ruby笔记]3. 语法检查ruby -cw xx.rb /代码运行 ruby xx.rb/变量约定 @ @@ $

2016-05-16 21:36 435 查看

ruby -cw xx.rb

ruby检查代码语法 ruby 后面加个 -cw

PS C:\Users\Administrator\RubyCode> more ex11.rb
# missing "
puts "Hello ,world

PS C:\Users\Administrator\RubyCode> ruby -cw ex11.rb
ex11.rb:2: unterminated string meets end of file


ruby xx.rb

ruby运行代码

PS C:\Users\Administrator\RubyCode> more ex11.rb
# no missing "
puts "Hello ,world "

PS C:\Users\Administrator\RubyCode> ruby ex11.rb
Hello ,world


Variable

各种变量的约定写法举例,akarin~( ‘-^ )-☆

TypeRuby convention
Localakaza_akarin
Instance@akaza_akarin
Class@@akaza_akarin
Global$akaza_akarin

Reference

《The Well-Grounded Rubyist, Second Edition》

(https://www.manning.com/books/the-well-grounded-rubyist-second-edition)

1.1.2. The variety of Ruby identifiers

1.1.3. Method calls, messages, and Ruby objects

1.1.4. Writing and saving a simple program

1.1.5. Feeding the program to Ruby

http://www.ioccc.org/2011/akari/akari.c

http://www.csdn.net/article/2012-04-25/2805007

      ∧_∧
    (・_・ =)
  _φノ__⊂)__
/ /三/ /|
|| ̄ ̄ ̄ ̄~|| |
|| ̄| ̄∪∪|| |
||/    ||/
 http://emoji.vis.ne.jp/benkyo_chu12.htm[/code] 
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ruby