最終更新:2017-08-07 (月) 05:37:47 (2426d)
guard
Top / guard
Guard Statement
A guard statement is used to transfer program control out of a scope if one or more conditions aren’t met.
A guard statement has the following form:
guard condition else { statements }
使い方
- 条件式がfalseの場合の処理のみを記述する構文
- アンラップした変数をスコープ外で利用する
- カンマで区切って複数条件をチェックしつつアンラップできる