Data Types
Every value in Acton is of a certain type. The type specifies what kind of data is being specified and how to work with that data. Acton has a number of built-in data types.
- integers, like
1,2,123512,-6542or1267650600228229401496703205376intis arbitrary precision and can grow beyond machine word sizesi16,i32,i64,u16,u32,u64are fixed size integers
- float 64 bit float, like
1.3or-382.31 - complex complex numbers like
1+2j boolboolean, likeTrueorFalsestrstrings, likefoo- strings support Unicode characters
- tuples for structuring multiple values, like
(1, "foo")or(a="bar", b=1337)
In Acton, mutable state can only be held by actors. Global definitions in modules are constant. Assigning to the same name in an actor will shadow the global variable.
| module level constant |
|
| this will print the global foo |
|
| set a local variable with the name foo, shadowing the global constant foo |
|
| print local foo, then call printfoo() |
|
Output:
local foo, shadowing the global foo: 4
global foo: 3
u16: 1234