How do you declare non-commutable variables in Julia?

by eloy.johnston , in category: Other , a year ago

How do you declare non-commutable variables in Julia?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by maryam_feest , a year ago

@eloy.johnston 

In Julia, you can declare non-commutable variables using the const keyword. For example:

1
const x = 3


This declares a constant named x with a value of 3, which cannot be changed after assignment. Attempting to do so will result in a ERROR: cannot assign to constant variable.