Update Examples

Glen Whitney 2024-08-24 04:50:46 +00:00
parent 98df7d16e1
commit 4c11a5126c

@ -73,10 +73,10 @@ fn main
let logical: bool = true
let a_float: f64 = 1.0 // Regular annotation
let an_integer = 5i32 // Suffix annotation
an_integer = 5i32 // Suffix annotation
let default_float = 3.0 // `f64`
let default_integer = 7 // `i32`
default_integer = 7 // `i32`
// Can infer from another line; here i64:
let mut inferred_type = 12
@ -289,13 +289,13 @@ struct Rectangle
fn main()
// Create struct with field init shorthand
let name = s"Peter" // note s-string
let age = 27
let peter = Person name, age
age = 27
peter = Person name, age
println! "{:?}", peter
let point: Point = Point x: 10.3, y: 0.4
let another_point: Point = Point x: 5.2, y: 0.2
another_point: Point = Point x: 5.2, y: 0.2
println! "point coordinates: ({}, {})", point.x, point.y