hello_world_42/lib.rs
1/// Adds two numbers and returns the result.
2///
3/// # Examples
4///
5/// ```
6/// let a: i32 = 2;
7/// let b: i32 = 4;
8/// assert_eq!(6, hello_world::add_numbers(a, b))
9/// ```
10pub fn add_numbers(a: i32, b: i32) -> i32 {
11 a + b
12}
13
14/// Subtracts two numbers and returns the result.
15///
16/// # Examples
17///
18/// ```
19/// let a: i32 = 10;
20/// let b: i32 = 4;
21/// assert_eq!(6, hello_world::sub_numbers(a, b))
22/// ```
23pub fn sub_numbers(a: i32, b: i32) -> i32 {
24 a - b
25}