勉強していて分からなくなったからRubyのdefについて、自分の振り返り用。
def はメソッドを定義するためにある。
def メソッド名
puts "hello"
end
hello
メソッド名を書くだけでhelloが出力される.
簡単に言うとトンカツ定食を注文すると、ご飯、味噌汁、トンカツ、サラダ、小鉢が付いてくる様な感じ。
Go to list of users who liked
More than 3 years have passed since last update.
勉強していて分からなくなったからRubyのdefについて、自分の振り返り用。
def はメソッドを定義するためにある。
def メソッド名
puts "hello"
end
hello
メソッド名を書くだけでhelloが出力される.
簡単に言うとトンカツ定食を注文すると、ご飯、味噌汁、トンカツ、サラダ、小鉢が付いてくる様な感じ。
Register as a new user and use Qiita more conveniently
Go to list of users who liked