How to create and print a sorted array in Swift

1 Answer

0 votes
import Foundation

// Create a sorted array
let sortedArray = [1, 2, 3, 4, 5, 6, 7]

// Print the array
print("Sorted Array: \(sortedArray)")

 
 
/*
run:

Sorted Array: [1, 2, 3, 4, 5, 6, 7]
 
*/

 



answered Mar 24, 2025 by avibootz
...