Created
February 16, 2019 12:51
-
-
Save keremvatandas/0e95793748617a8b39f737f3a17359bb to your computer and use it in GitHub Desktop.
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
| func getMax<T: Comparable>(dizi a: [T]) -> T | |
| { | |
| var max = a[0] | |
| for i in 1..<a.count { | |
| if max < a[i] { | |
| max = a[i] | |
| } | |
| } | |
| return max | |
| } | |
| let sayiDizisi = [97, 34, 1, 129, 444] | |
| getMax(dizi: sayiDizisi) // 444 | |
| let sayiDizisi2 = [97.0, 97.12, 1, 97.88, 97.9] | |
| getMax(dizi: sayiDizisi2) // 97.90000000000001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment