Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null回避のあたりのリファクタ #141

Open
kmdkuk opened this issue Sep 23, 2020 · 0 comments
Open

null回避のあたりのリファクタ #141

kmdkuk opened this issue Sep 23, 2020 · 0 comments
Labels

Comments

@kmdkuk
Copy link
Member

kmdkuk commented Sep 23, 2020

概要

  • ?や??を利用する.
  • user?.idusernullのときuser?.idnullを返す.user.idだともしusernullのときエラーが発生する.
  • user ??= User()は,usernullのときは,User()を代入する式
  • expr1 ?? expr2 は,もしexpr1が非nullのときはその値を返す;そうでなければ、expr2を計算して返す。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant