0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ruby コーティング規約について レイアウト編 3

Posted at

はじめに

前回の続きです。
Rubyの基礎を学習中の方に向けて記載致します。
私自身これからチーム開発を行う上で大事にしたい。知っておきたいことをOutputします。

#レイアウトについて
① メソッドの引数に値を入れる時、 =の周りにはスペースを入れる。

qiita.rb
# 悪い例
def some_power(action1=:punch, action2=kick, action3=jump)
  # do something...
end

# 良い例
def some_power(action1 = :punch, action2 = kick, action3 = jump)
  # do something...
end

② 可読性のため、大きな数値にはアンダースコアをつける。

qiita.rb
# 0はいくつありますか?

# 悪い例 
num = 1000000

# 良い例 
num = 1_000_000

#さいごに
毎日更新します。
皆様の復習等にご活用頂けますと幸いです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?