Add in.go
This commit is contained in:
parent
0fcb1cc391
commit
db323908ac
13
common/in.go
Normal file
13
common/in.go
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package common
|
||||||
|
|
||||||
|
// In picks x if y < x, picks z if y > z, or if none of the previous
|
||||||
|
// conditions is satisfies, it simply picks y.
|
||||||
|
func In(x, y, z int) {
|
||||||
|
switch {
|
||||||
|
case y < x:
|
||||||
|
return x
|
||||||
|
case y > z:
|
||||||
|
return z
|
||||||
|
}
|
||||||
|
return y
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user