cocoa on-rails-5th
DESCRIPTION
TRANSCRIPT
![Page 1: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/1.jpg)
Ruby
Cocoa on Rails5th
2011-7-25
![Page 2: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/2.jpg)
这节课讲什么
Ruby 语法
![Page 3: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/3.jpg)
Interactive Ruby
开始 -> 程序 ->Ruby 1.9.2->
Interactive Ruby
![Page 4: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/4.jpg)
Hello World
Irb>puts “hello world”
=>”hello world”
=> nil
![Page 5: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/5.jpg)
计算器
irb> 1 + 2
=> 3
![Page 6: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/6.jpg)
数学公式
Irb>Math.sqrt(9)
=> 3.0
![Page 7: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/7.jpg)
函数irb> def h
irb> puts "Hello World!"
irb> end
=> nil
=> h
=> h()
![Page 8: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/8.jpg)
可接受参数的函数
irb> def h(name)
irb> puts "Hello #{name}!"
irb> end
irb> h(“Junli")
![Page 9: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/9.jpg)
将代码放入文件
puts “hello world”
保存为 hello.rb
在命令行下,运行 ruby hello.rb
![Page 10: Cocoa on-rails-5th](https://reader037.vdocuments.pub/reader037/viewer/2022103111/54bd19644a7959135f8b4610/html5/thumbnails/10.jpg)
下一课程
待定