Output using methods and constants Learning memo

It is a learning memo.

Output as it is

puts "I like sea urchin!"

Output using method

class Favorite
  def self.food
    puts "I like sea urchin!"
  end
end

Favorite.food

Output using constants

FAVORITE = "I like sea urchin!"

puts FAVORITE

Recommended Posts

Output using methods and constants Learning memo
About redirect and forward
Java learning memo (basic)
Java learning memo (interface)
Java learning memo (inheritance)
Java learning memo (logical operator)
Java learning memo (abstract class)
Java learning memo (while statement, do-while statement)
Output using methods and constants Learning memo
[Learning Memo] Metaprogramming Ruby 2nd Edition: Chapter 3: Methods
Java learning memo (interface)
Java learning memo (inheritance)