A class is defined with the class keyword, followed by an end.
# The class identifier is a constant, so it must be capitalized (the norm)
class Hello
def initialize( name )
@name = name
end
def hello_myValue
puts "Hello, " + @name + "!"
end
end
hi = Hello.new( "myValue" )
hi.hello_myValue
Related examples in the same category