Skip to content

Instantly share code, notes, and snippets.

@makiftutuncu
Created December 15, 2015 20:45
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 makiftutuncu/6e8c162edbf9dafe51d1 to your computer and use it in GitHub Desktop.
Save makiftutuncu/6e8c162edbf9dafe51d1 to your computer and use it in GitHub Desktop.
Scala'da Döngü İfadeleri Yazımdaki Örnek 3
// Java
for (int i = 1; i <= 20; i += 2) {
for (j = i; j <= i * 2 && j < 14; j++) {
System.out.print("[" + i + ", " + j + "] ");
}
}
// Scala
for {
i <- 1 to 20 by 2
j <- i to (i * 2) if j < 14
} {
print("[" + i + ", " + j + "] ")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment