[Swift🕊️] `guard let` must not fall through !

Swift

I believed Swift could the following code like this.

Swift

guard let a = a else {
assert(false, "This code would be compile error!!!")
}

This syntax is very normal. Because if you(me) build the code as product version, assert statement will ignore and fall through the code. Finally, This statement will be created!

a has nil. But `guard` doesn't work.

Please be careful.

コメント

タイトルとURLをコピーしました