- Run code:
function sayHello()
println("Hello, world!")
end
it returns sayHello (generic function with 1 method)
.
- Run code:
"""
Say hello world
"""
function sayHello()
println("Hello, world!")
end
it returns sayHello
only.
Why are they designed to have different values?
Not sure why this happens (good catch) but in the end both have the exact same type and behavior. This is just a display quirk.
3 Likes
julia> """
Say hello world
"""
function sayHello()
println("Hello, world!")
end
sayHello
julia> sayHello
sayHello (generic function with 1 method)
so if you look at the second definition afterwards in REPL you get the same as for the first. The difference might just be how the “add documentation as well” part is processed?
1 Like
yeah - same behavior (or, behaviour? )
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.9.0 (2023-05-07)
_/ |\__'_|_|_|\__'_| |
|__/ |
julia> "say hello"
function sayHello()
println("hello")
end
sayHello