Skip to content

Instantly share code, notes, and snippets.

@fatihemree
Last active August 21, 2020 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatihemree/1500f19b05ac324a558cf9cd5146902f to your computer and use it in GitHub Desktop.
Save fatihemree/1500f19b05ac324a558cf9cd5146902f to your computer and use it in GitHub Desktop.
// If Expression
// 1 Example------------------------------------
var hiz: Int = 90
var hizSiniri: Int = 120
if (hiz > hizSiniri) {
print('Hız sınırını geçtiniz')
} else {
print('Hızınız:' + hiz)
}
// Log: Hızınız: 90
// 2 Example------------------------------------
var hiz:Int = 130
var hizSiniri:Int=120
var result : String= if(hiz > hizSiniri) "Hız sınırını geçtiniz" else "Hızınız $hiz"
print(result)
//Log: "Hız sınırını geçtiniz"
// Else-if -------------------------------------
// 1 Example
var not : Int = 90
print("Not: $not \n")
if(not >= 80 && not<=100)
print("Kanka hiç çalışmadım")
else if (not >= 50 && not<=79)
print("Biraz notlara baktım")
else
print("adammmm")
//Log: Not: 90
// Kanka hiç çalışmadım
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment