From 4eb51709413de9867427b154dfb40b633318b095 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Tue, 13 Feb 2024 10:45:07 +0100 Subject: [PATCH] update rust --- technology/dev/programming/languages/Rust.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/technology/dev/programming/languages/Rust.md b/technology/dev/programming/languages/Rust.md index bc8a09d..11bb7e1 100644 --- a/technology/dev/programming/languages/Rust.md +++ b/technology/dev/programming/languages/Rust.md @@ -148,6 +148,13 @@ fn add_two(a: isize) -> isize { } ``` +The default return type of a function is the Unit Type `()`. You can also signal that a function will never return with `!` +```rust +fn infinity() -> ! { + loop {} +} +``` + ### Enums Rust has enums which can even hold some data. ```rust