# Symbolics: ERROR: TypeError: non-boolean (Num) used in boolean context

**URL:** https://discourse.julialang.org/t/symbolics-error-typeerror-non-boolean-num-used-in-boolean-context/58640
**Category:** New to Julia
**Tags:** symbolics
**Created:** [April 5, 2021, 7:25pm UTC](https://discourse.julialang.org/t/symbolics-error-typeerror-non-boolean-num-used-in-boolean-context/58640 "2021-04-05T19:25:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Allan\_Baker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/allan_baker/32/42645_2.png) [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)
#### Post date: [April 5, 2021, 7:25pm UTC](https://discourse.julialang.org/t/symbolics-error-typeerror-non-boolean-num-used-in-boolean-context/58640/1 "2021-04-05T19:25:10Z")

</div>

So what should one do if you want to evaluate a function symbolically and there may be things like boolean switches in it? Is there such a thing as switchable symbolic equations?

I had some functions like that may include a simple little boolean switch like below to limit an input. Wondering if there is julia magic that eventually would end up splitting up the boolean logic into different conditional functions. That would be cool. Having not done much with Symbolic’s in any language… I don’t know if this is a crazy question.

`xminmax(x,xmin,xmax) = x > xmax ? xmax : ( x < xmin ? xmin : x ) # Check the min max and clip it`

Is there a more Symbolic friendly way to do this?

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [April 5, 2021, 7:41pm UTC](https://discourse.julialang.org/t/symbolics-error-typeerror-non-boolean-num-used-in-boolean-context/58640/2 "2021-04-05T19:41:42Z")

</div>

Use `IfElse.ifelse` until we make the symbolic parsing use SymbolicTracing.jl

---

<div class="post-metadata">

### Author: ![Allan\_Baker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/allan_baker/32/42645_2.png) [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)
#### Post date: [April 5, 2021, 8:43pm UTC](https://discourse.julialang.org/t/symbolics-error-typeerror-non-boolean-num-used-in-boolean-context/58640/3 "2021-04-05T20:43:01Z")

</div>

> [@ChrisRackauckas](#):
>
> IfElse.ifelse

Well that is interesting. Cool.
