Created
December 15, 2015 20:45
-
-
Save makiftutuncu/6e8c162edbf9dafe51d1 to your computer and use it in GitHub Desktop.
Scala'da Döngü İfadeleri Yazımdaki Örnek 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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