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.

|= or equal記法について

Last updated at Posted at 2021-02-20

概要

  • 記法.... 変数1 ||= 変数2or関数
  • 意味.... 変数1nilの場合,変数2を代入する。そうでない場合は,何も代入しない。

  • @foo ||= "bar"
  • @fooに値が存在する場合は,何も代入しない,nilの場合は文字列barを代入する
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?