May 2019
Beginner to intermediate
466 pages
10h 44m
English
Constants are variables that, once declared, can't be changed. They are declared by prefixing them with the const keyword:
julia> const firstmonth = "January"
Very importantly in Julia, constants are not concerned with their value, but rather with their type. It is a bit too early to discuss types in Julia, so for now it suffices to say that a type represents what kind of a value we're dealing with. For instance, "abc" (within double quotes) is of type String, 'a' (within single quotes) is of type Char , and 1000 is of type Int (because it's an integer). Thus, in Julia, unlike most other languages, we can change the value assigned to a constant as long as the type remains the same. For instance, we can at first decide that eggs ...
Read now
Unlock full access