# Why \`"hello"^true\` is allowed?

**URL:** <https://discourse.julialang.org/t/why-hello-true-is-allowed/4849>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 14, 2017, 8:32am UTC](https://discourse.julialang.org/t/why-hello-true-is-allowed/4849 "2017-07-14T08:32:45Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 16, 2017, 11:29am UTC](https://discourse.julialang.org/t/why-hello-true-is-allowed/4849/21 "2017-07-16T11:29:22Z")

</div>

> [@ScottPJones](#):
>
> Do you honestly think that seeing foo^n in the middle of some code is more comprehensible than repeat(foo, n), when the type of foo may not even be given in the function?

Personally, I try not to think too much about this. I am happy with whatever option the core team picks, provided that we don’t keep discussing it. I can appreciate arguments for all sides of this debate, but for me this does not make it into the top 500 issues, and the discussion/importance ratio for this particular issue appears to approach ∞.

---

<div class="post-metadata">

**Author:** ![ararslan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ararslan/32/3825_2.png) [@ararslan](https://discourse.julialang.org/u/ararslan)\
**Post date:** [July 23, 2017, 10:42pm UTC](https://discourse.julialang.org/t/why-hello-true-is-allowed/4849/22 "2017-07-23T22:42:12Z")

</div>

To directly address the original question,

> Why allow exponentiation with a Boolean?

If you look at what’s actually being called, you’ll find that there isn’t an explicit method for `Bool`:

```julia
julia> @which "hello"^true
^(s::AbstractString, r::Integer) in Base at strings/types.jl:154

```

The fact that `"hello"^true` works is actually just a side effect of the fact that `Bool <: Integer`.

[Previous page](https://discourse.julialang.org/t/why-hello-true-is-allowed/4849.md?page=1)
