Skip to content
Justin Mann edited this page Nov 11, 2017 · 6 revisions

If you need to convert (cast) from one type to another you can use the "cast" operator. It can handle converting between the basic types: int, float, and bool.

To cast from one type to another:

// i32 to f32
1 as f32

// f64 to i32
1.0 as i32

Clone this wiki locally