Constants in Lisp
Go by Example: Constants
Go supports constants of character, string, boolean, and numeric values.
A const
statement can appear anywhere a var
statement can.
Constant expressions perform arithmetic with arbitrary precision.
A numeric constant has no type until it’s given one, such as by an explicit conversion.
A number can be given a type by using it in a context that requires one, such as a variable assignment or function call. For example, here math.sin
expects a float64
.
To run the program, put the code in a file and load it in a Common Lisp environment.
When executed, the program outputs:
Now that we can work with constants in Common Lisp, let’s learn more about the language.