# A switch type function

**URL:** https://discourse.julialang.org/t/a-switch-type-function/13491
**Category:** New to Julia
**Tags:** control-flow
**Created:** [August 15, 2018, 8:45am UTC](https://discourse.julialang.org/t/a-switch-type-function/13491 "2018-08-15T08:45:57Z")
**Posts on this page:** 1
**Showing post:** 19

<div class="post-metadata">

### Author: ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)
#### Post date: [August 13, 2021, 8:16pm UTC](https://discourse.julialang.org/t/a-switch-type-function/13491/19 "2021-08-13T20:16:13Z")

</div>

It is not necessary to check the left interval border.

```julia
n = 1.1
m = n ≤ 0.1 ? 0.0 :
    n ≤ 0.6 ? 1.0 :
    n ≤ 0.8 ? 1.1 :
    n ≤ 1.0 ? 1.2 :
    n ≤ 1.3 ? 1.35 :
    #= otherwise =# 2.2

```

---

_[View the full topic](https://discourse.julialang.org/t/a-switch-type-function/13491)._
