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
Learning output ~ 11/3 ~
Learning output
JAVA learning history abstract classes and methods
How to execute and mock methods using JUnit
A memo when fumbling and developing using JavaFX
Functions and methods
Ruby Learning # 15 Methods
[Learning Memo] Metaprogramming Ruby 2nd Edition: Chapter 3: Methods
Try using java.lang.Math methods
Java learning memo (method)
Learning memo 01 (forward / redirect)
Ruby Learning # 31 Object Methods
[Test code learning / output]
Java learning memo (basic)
[Swift] Constants and variables
Ruby variables and methods
Java learning memo (interface)
Java learning memo (inheritance)
[Rails] Differences between redirect_to and render methods and how to output render methods