Stream: helpdesk (published)

Topic: ✔ How do I dispatch when a param is a data type?


view this post on Zulip G Gundam (Dec 11 2024 at 00:53):

How do I implement f(type) such that it behaves like this?

julia> f(Int64)
"something"

julia> f(Float64)
"something completely different"

view this post on Zulip Mosè Giordano (Dec 11 2024 at 00:56):

f(::Type{Int64}) = ...
f(::Type{Float64}) = ...

view this post on Zulip G Gundam (Dec 11 2024 at 00:57):

Perfect. Thank you.

view this post on Zulip Notification Bot (Dec 11 2024 at 00:57):

G Gundam has marked this topic as resolved.


Last updated: Dec 28 2024 at 04:38 UTC