You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feel free to check out the tests for more examples!
34
+
35
+
36
+
37
+
# Clamps #
38
+
39
+
This includes a few functions which make it easy to clamp a value between two others. Like Swift's `min` and `max`, these work for any `Comparable` type.
40
+
41
+
Whichever you use simply depends on your preference or needs; they all act identically:
42
+
43
+
```swift
44
+
print(clamp(min: 2, value: 0, max: 7)) // Prints 2
45
+
print(clamp(min: 2, value: 5, max: 7)) // Prints 5
46
+
print(clamp(min: 2, value: 99, max: 7)) // Prints 7
0 commit comments