# Bools in arithmetic operations

**URL:** https://discourse.julialang.org/t/bools-in-arithmetic-operations/52504
**Category:** New to Julia
**Tags:** boolean
**Created:** [December 28, 2020, 12:07pm UTC](https://discourse.julialang.org/t/bools-in-arithmetic-operations/52504 "2020-12-28T12:07:15Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)
#### Post date: [December 28, 2020, 12:24pm UTC](https://discourse.julialang.org/t/bools-in-arithmetic-operations/52504/2 "2020-12-28T12:24:07Z")

</div>

For the general question of [“why is `Bool` an `Integer`”](https://discourse.julialang.org/t/why-is-bool-an-integer/17237), see:

[https://github.com/JuliaLang/julia/issues/19168](https://github.com/JuliaLang/julia/issues/19168)

For your particular case, if you don’t want `Bool` to be accepted as input in your function, just make it throw an error in such a case:

```julia
julia> gety(m, ::Bool) = throw(ArgumentError("Bool not allowed"))
gety (generic function with 1 method)

julia> gety(m, true)
ERROR: ArgumentError: Bool not allowed
Stacktrace:
 [1] gety(::Array{Int64,1}, ::Bool) at .\REPL[1]:1
 [2] top-level scope at REPL[2]:1234:1

```

---

_[View the full topic](https://discourse.julialang.org/t/bools-in-arithmetic-operations/52504)._
