Skip to content

Instantly share code, notes, and snippets.

@swdevbali
Created November 1, 2021 23:10
Show Gist options
  • Save swdevbali/7f277c19f9dd9f09526e9a144afb5fc9 to your computer and use it in GitHub Desktop.
Save swdevbali/7f277c19f9dd9f09526e9a144afb5fc9 to your computer and use it in GitHub Desktop.
// Conditional statement
// https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html
if tomato.name.contains("Swift") {
print("Good for you!")
}else{
print("That's fine. You can use Flutter or ReactNative too. It even cross platfrom solution!")
}
// Loop
let languages = ["Python", "Golang", "Swift", "Java"]
for l in languages{
print(l + " is good!")
}
// https://pypl.github.io/PYPL.html
let popularity_of_languages = ["Python": 1, "Golang": 13, "Swift": 9, "Java":2]
for (lang, pop) in popularity_of_languages{
print(lang + " is number " + String(pop))
}
for rank in 1...9{
if (rank==9){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment