ava/values.md

35 lines
994 B
Markdown

# Values
Values consist of literals and the results of expressions.
## Literals for Standard Types
`Boolean`: `let x: Boolean := true`
`Int8`: `let x: Int8 := 0`
`UInt8`: `let x: UInt8 := 0`
`Int16`: `let x: Int16 := 0`
`UInt16`: `let x: UInt16 := 0`
`Int32`: `let x: Int32 := 0`
`UInt32`: `let x: UInt32 := 0`
`Int64`: `let x: Int64 := 0`
`UInt64`: `let x: UInt64 := 0`
`Float32`: `let x: Float32 := 0.0`
`Float64`: `let x: Float64 := 0.0`
`BigInt`: `let x: BigInt := 9999999999999999999999999999999`
`Decimal`: `let x: Decimal := 9999999999999999999999999999999.9999999999999999`
`String`: `let x: String := "foo"`
`List[A]`: `let x: List[Int32] := {1, 2, 3}`
`Array[A]`: `let x: Array[Int32] := {1, 2, 3}`
### Numeric Literal Defaults
- If no type is specified, any integer is assumed to be `Int32`.
- If no type is specified, any floating point value is assumed to be `Float64`.
## Tuple Literals
The type will be inferred to `(Int32, Int32, String)`
```
let x := (1, 2, "foo")
```