Learn Before
Concept
Functions - Rust Programming
Functions are commonly used in Rust code, with the main function being a key element and entry point for many programs. The fn keyword is used to create new functions.
Syntax:
fn function_name(parameter_name: parameter_type) -> return_type { // code block }
For example:
fn add(a: i32, b: i32) -> i32 { a + b }
0
1
Updated 2023-01-29
Tags
Object-Oriented Programming