Skip to content

Instantly share code, notes, and snippets.

@LucasMolinag
LucasMolinag / oop.rb
Created August 22, 2023 01:46
W9D1 - Instance Variables
class Person
attr_accessor :name
def initialize(name)
@name = name
end
end
p = Person.new('L. Ron')
puts p.name
def benchmark
start_time = Time.now
yield
end_time = Time.now
end_time - start_time
end
# Be careful, pasting this into IRB will take a long time to print.
# It's a loooong string. :)
long_string = "apple"*100000000