[Rust] Unit Type in Rust
Everything in Rust has a type. Even functions that don't seem to return anything. In such and similar cases, we're dealing with a Unit Type. Learn about it in this lesson.
#[allow(warnings)]
fn main() {
say_hello();
}
// by default function return a unit type
fn say_hello() {
println!("Hello!");
}
// the same as
fn say_hello() -> (){
println!("Hello!");
}