Skip to content

Instantly share code, notes, and snippets.

@gotev
Last active July 12, 2018 13:56
Show Gist options
  • Save gotev/b495175279d5e18a82e455cb956810f2 to your computer and use it in GitHub Desktop.
Save gotev/b495175279d5e18a82e455cb956810f2 to your computer and use it in GitHub Desktop.
Guard let comparison between Kotlin and Swift

Kotlin

val url = lastRadioUrl ?: run {
    doSomething()
    return
}
// use url which is not null

Swift

guard let url = lastRadioUrl else {
    doSomething()
    return
}
// use url which is not nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment