0
1

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】変数の命名ルールについて。定数、クラス、メソッドの命名規則も。

Posted at

個人メモです。

JSでは変数の定義時にlet, constなど宣言があるが、rubyでは特に宣言がなく、区別方法を調べてみたのでそのまとめ。

対象 命名規則 実例
変数 小文字。アンスコでつなげる product_name
定数 すべて大文字。アンスコでつなげる PLODUCT_PRICE_LIST
クラス 冒頭だけ大文字。キャメル ProductCategory
メソッド 小文字。アンスコでつなげる show_price_list

定数はすべて大文字なので区別しやすい。
ハイフンは使わない。

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?