# Unitful dispatch

**URL:** <https://discourse.julialang.org/t/unitful-dispatch/49480>\
**Category:** General Usage\
**Tags:** unitful, multidispatch\
**Created:** [November 2, 2020, 9:16pm UTC](https://discourse.julialang.org/t/unitful-dispatch/49480 "2020-11-02T21:16:58Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [November 3, 2020, 2:37am UTC](https://discourse.julialang.org/t/unitful-dispatch/49480/9 "2020-11-03T02:37:16Z")

</div>

Just don’t specify the units you want, instead specify the dimensions. E.g. in this case, you want any `Quantity` which has dimensions of `𝐓^-1`, so you just do

```julia
julia> using Unitful; using Unitful: Hz, s, 𝐓

julia> f(x::Quantity{<:Any, 𝐓^-1}) = 2x
f (generic function with 1 method)

julia> f(2.0Hz)
4.0 Hz

julia> f(1/0.5s)
4.0 s^-1

```

---

_[View the full topic](https://discourse.julialang.org/t/unitful-dispatch/49480)._
