Skip to content

Instantly share code, notes, and snippets.

@makiftutuncu
Last active December 8, 2015 19:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Scala'da Koşul İfadeleri yazımdaki örnek 2
// Java
String metin = "merhaba";
int uzunlukSeviyesi; // 1, 2 veya 3
if (metin.length < 2) {
uzunlukSeviyesi = 1;
} else if (metin.length < 4) {
uzunlukSeviyesi = 2;
} else {
uzunlukSeviyesi = 3;
}
// Scala
val metin = "merhaba"
val uzunlukSeviyesi = if (metin.length < 2) {
1
} else if (metin.length < 4) {
2
} else {
3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment