Basic types in Odin
Sized integers and floats, a rune, and a bool for the lighthouse log.
package main
import "core:fmt"
main :: proc() {
// Sized integers and floats; int is the word-size default.
crew: u8 = 12
depth: i32 = -180
ratio: f32 = 42.75
// rune is a Unicode code point; strings are immutable UTF-8.
initial: rune = 'G'
watching := true
fmt.println("crew", crew, "depth", depth, "ratio", ratio)
fmt.printfln("initial %c, storm watch %t", initial, watching)
}
How it works
u8,i32, andf32size the crew, the depth, and the ratio exactly.runeis a Unicode code point; strings are immutable UTF-8.%cand%tprint the rune and the bool in the closing report.
Keywords and builtins used here
f32i32importpackageprocruneu8
The run, in numbers
- Lines
- 17
- Characters to type
- 383
- Tokens
- 76
- Three-star pace
- 70 tpm
At the three-star pace of 70 tokens a minute, this run takes about 65 seconds.
Step 3 of 3 in Values, step 3 of 27 in Language basics.