Post

Replies

Boosts

Views

Activity

Tuple Comparision
I was trying to evaulate let myTuple = ("blue", false) let otherTuple = ("blue", true) if myTuple < otherTuple { print("yes it evaluates") } Ans I got /tmp/S9jAk7P7KW/main.swift:5:12: error: binary operator '<' cannot be applied to two '(String, Bool)' operands if myTuple < otherTuple { My question is why there is no compile time issue in first place where the declaration is let myTuple = ("blue", false) ~~~~~~ something like above
2
0
477
Jul ’25
Range For Keys and Values Of Dictionary
I came across a code let myFruitBasket = ["apple":"red", "banana": "yellow", "budbeeri": "dark voilet", "chikoo": "brown"] Can we have range for keys and values of dictionary, it will be convenient for keys print(myFruitBasket.keys[1...3]) // banana, budbeeri, chikoo same for values print(myFruitsBasket.values[1...3]) // yellow, voilet, brown
4
0
484
Aug ’25