i have a small problem.
I have an array with a integer of value:
let array = [99, 42, 34, 19, 167, 30, 49, 39, 75, 175, 270, 540]
How do I get all the values between 19 and 167 for example? There has to be a better way than a for iteration through all the integer value ? this is on swift. so i am looking for answer on swift. thanks in advance
In Swift, you can still do this using filter
let array = [99, 42, 34, 19, 167, 30, 49, 39, 75, 175, 270, 540]
let newArray = array.filter{$0 > 19 && $0 < 167}
print(newArray)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With