I am migrating from Python where I had been using triple quoted strings of two kinds to insert multi-line comments and one-line strings of both kinds which were all differently highlighted anywhere in the code as standalone strings are allowed syntax. How to accomplish the same in Julia? I mean being able to put anywhere in the code any Unicode text with as less of prefix and postfix characters as possible?
You can use line comments and region comments.
# this is á comment
a = 14
#=
this is a cômment
over several lines
=#
b = a + #=ånywhere in the code=# 42
3 Likes
julia> 5 + #=== #== #= addition here =# ==# ===# 5
10
suggests that nesting of higher level comments is supported in Julia. Is this conclusion correct? Is there maybe an alternative syntax using a less obtrusive characters for invoking a comment like for example: ·˙ some comment ˙· ?
Yes, #= =#
comments nest. Punctuation · The Julia Language
Unlike Lua, the extra ='s have no significance to the parser.
julia> 5 + #=== #== #= addition here =# ==# ===# 5
10
julia> 5 + #= #= #= addition here =# =# =# 5
10
julia> 5 + #= #== #=== addition here =# ==# ===# 5
10
1 Like