Closed YaKudryk closed 4 years ago
import Foundation var someInts : [Int] someInts = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] someInts.shuffle()
func greet(accesing:Bool, intarray: [Int]) -> [Int] {
var sorted:[Int]
sorted=[]
if !(intarray == nil) { //waat i do if array nil? output empty array!
if !(intarray.isEmpty) {
sorted = intarray.sorted()
if !(accesing) {
sorted = sorted.reversed()
}
}
}
return sorted
}
print("Unsorted")
print(someInts)
print("Sorted accesing")
print(greet(accesing:true, intarray:someInts))
print("Sorted deccesing")
print(greet(accesing:false, intarray:someInts))
Zadachi from Vova 1.txt