Rubyとは
Rubyは、手軽なオブジェクト指向プログラミングを実現するための種々の機能を持つオブジェクト指向スクリプト言語です。
[gist 5598133]
Try Ruby
[person.rb]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Person
def initialize(name)
@name = name
end
def hello
"Hello, friend!\nMy name is #{@name}!"
end
end
charlie = Person.new("Charlie")
puts charlie.hello
#=> Hello, friend!
#=> My name is Charlie!