Can `π` be used as a general variable name?

julia> π = 1
ERROR: cannot assign a value to imported variable MathConstants.π from module Main

I know π is the circular constant, but is it always a reserved variable in Julia? Can I borrow it temporarily?

You can assign to it, just not if you have already imported it from another module.

julia> π = 1
1
1 Like

I see. You mean once I have used π as the circular constant, I will not be able to assign any other number to it?

Julia will prove popular in Indiana in this case

https://cs.uwaterloo.ca/~alopez-o/math-faq/mathtext/node18.html

1 Like

Once you have imported π as the circle constant (or any other value) in a given module, you will not be able to assign any other number to it in that module.

1 Like

Well, I see. Many thanks! :handshake: :handshake: