[RUBY] What is the initialize method?

What is the initialize method?

In the method called in the new method when the instance is created

As a usage

class User
  def initialize(user1, user2)
    @user1 = user1
    @user2 = user2

  def response
    puts "#{@user1}Next is#{@user2}Mr. is"

puts "Who came out first?"
friend1 = gets(chomp: true)
puts "Who came out next?"
friend2 = gets(chomp: true)

answer = User.new(friend1, friend2)

Recommended Posts

What is the initialize method?
What is the pluck method?
What is the main method in Java?
What is the BufferedReader class?
What is the constructor for?
initialize method
About the role of the initialize method
What kind of method is define_method?
What is the difference between an action and an instance method?
What is Cubby
What is Docker?
What is null? ]
What is java
What is the right migration data type? ??
What is Keycloak
What is testing? ・ About the importance of testing
What is maven?
What is Jackson?
[For programming beginners] What is a method?
What is Docker
What is Jenkins
What is ArgumentMatcher?
What is IM-Juggling?
What is the best file reading (Java)
What is params
What is SLF4J?
About the method
What is the model test code testing
What is Java <>?
What is Gradle?
What is POJO
What is Java
What is the data structure of ActionText?
What is the Facade pattern useful for?
What is centOS
What is RubyGem?
What is programming?
[Ruby] initialize method
What is before_action?
What is Byte?
What is Tomcat
[Ruby] What happens if the method self is used as the return value?
What is Pullback doing in The Composable Architecture
What is JSP? ~ Let's know the basics of JSP !! ~
What is the Java Servlet / JSP MVC model?
The order of Java method modifiers is fixed
What is different from the PHP language. [Note]
What is the volatile modifier for Java variables?
Output about the method # 2
What is Maven Assembly?
Ruby Learning # 30 Initialize Method
What is a constructor?
What is vue cli
What is an interface?
What is Ruby's self?
What is hard coding?
What is a stream
What is Ruby's attr_accessor?
What is Java Encapsulation?
What is permission denied?
What is instance control?