update rust

This commit is contained in:
JMARyA 2024-02-13 10:45:07 +01:00
parent 0b22ef1121
commit 4eb5170941
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -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