Ruby Examples

This commit is contained in:
2026-01-15 14:01:21 +09:00
commit cf3d7d3296
76 changed files with 1191 additions and 0 deletions

25
level7/66.rb Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
여러 Person 객체를 배열로 관리
=end
class Person
attr_accessor :name, :age
def initialize(name, age)
@name = name
@age = age
end
def grow_up
@age += 1
end
end
people = [
Person.new("Charlie", 13),
Person.new("Steve", 48),
Person.new("Anne", 34)
]