# Np.select equivalent to deal with multiple conditions

**URL:** <https://discourse.julialang.org/t/np-select-equivalent-to-deal-with-multiple-conditions/87639>\
**Category:** New to Julia\
**Tags:** question, array\
**Created:** [September 22, 2022, 12:23pm UTC](https://discourse.julialang.org/t/np-select-equivalent-to-deal-with-multiple-conditions/87639 "2022-09-22T12:23:25Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)\
**Post date:** [September 22, 2022, 2:34pm UTC](https://discourse.julialang.org/t/np-select-equivalent-to-deal-with-multiple-conditions/87639/3 "2022-09-22T14:34:24Z")

</div>

```julia
julia> [x<3 ? x : x>3 ? x^2 : 42 for x in 0:5]
7-element Vector{Int64}:
  0
  1
  2
 42
 16
 25

```

is simple and readily extendible.

---

_[View the full topic](https://discourse.julialang.org/t/np-select-equivalent-to-deal-with-multiple-conditions/87639)._
