From 596b7dfc30550254e13a96000da881958a9152d7 Mon Sep 17 00:00:00 2001 From: Adam Ward Date: Mon, 26 Feb 2024 10:58:18 -0800 Subject: [PATCH] Update new_types.md wording * Reword example code from "old enough" to "is an adult". * Use 25 years old, not 5 years old. --- src/generics/new_types.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/generics/new_types.md b/src/generics/new_types.md index c819002c28..a879ddb64c 100644 --- a/src/generics/new_types.md +++ b/src/generics/new_types.md @@ -25,16 +25,16 @@ impl Days { } } -fn old_enough(age: &Years) -> bool { +fn is_adult(age: &Years) -> bool { age.0 >= 18 } fn main() { - let age = Years(5); + let age = Years(25); let age_days = age.to_days(); - println!("Old enough {}", old_enough(&age)); - println!("Old enough {}", old_enough(&age_days.to_years())); - // println!("Old enough {}", old_enough(&age_days)); + println!("Is an adult? {}", is_adult(&age)); + println!("Is an adult? {}", is_adult(&age_days.to_years())); + // println!("Is an adult? {}", is_adult(&age_days)); } ```