I tried a simple code with julia:
x = readline()
and Julia took the variable as “x!”, instead of “x”.
But, it was just fine when I changed the “!” with “.”
Is “!” a special character or else?
I need some explanation. Thank you!
julia> x = 3; print(String("Hello, $(x)!"))
Nothing special about the
! in this context. It is just that
x! is a valid variable name.
Oh okay, that works . Thank you very much!
Thank you for the answer. I didn’t know if Julia accept such “!” character as a valid variable, unlike Python.
you can see a lot of functions has
! in them, such as
push!, to hint an in-place operation or side-effect (non-pure).
Perfect. But just to complement, it is worth mentioning that a valid function name is also a valid variable name. So what is seen in function names can also be seen in variable names.