Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Cocoa on-rails-5th


Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Cocoa on-rails-5th

  1. 1. Ruby <ul><li>Cocoa on Rails </li></ul><ul><li>5th </li></ul><ul><li>2011-7-25 </li></ul>
  2. 2. 这节课讲什么 <ul><li>Ruby 语法 </li></ul>
  3. 3. Interactive Ruby <ul><li>开始 -> 程序 ->Ruby 1.9.2-> </li></ul><ul><li>Interactive Ruby </li></ul>
  4. 4. Hello World <ul><li>Irb>puts “hello world” </li></ul><ul><li>=>”hello world” </li></ul><ul><li>=> nil </li></ul>
  5. 5. 计算器 <ul><li>irb> 1 + 2 </li></ul><ul><li>=> 3 </li></ul>
  6. 6. 数学公式 <ul><li>Irb>Math.sqrt(9) </li></ul><ul><li>=> 3.0 </li></ul>
  7. 7. 函数 <ul><li>irb> def h </li></ul><ul><li>irb> puts &quot;Hello World!&quot; </li></ul><ul><li>irb> end </li></ul><ul><li>=> nil </li></ul><ul><li>=> h </li></ul><ul><li>=> h() </li></ul>
  8. 8. 可接受参数的函数 <ul><li>irb> def h(name) </li></ul><ul><li>irb> puts &quot;Hello #{name}!&quot; </li></ul><ul><li>irb> end </li></ul><ul><li>irb> h(“Junli&quot;) </li></ul>
  9. 9. 将代码放入文件 <ul><li>puts “hello world” </li></ul><ul><li>保存为 hello.rb </li></ul><ul><li>在命令行下,运行 ruby hello.rb </li></ul>
  10. 10. 下一课程 <ul><li>待定 </li></ul>