Functions are a fundamental building block in Rust, as in any programming language. They allow you to encapsulate logic and reuse code, making your programs more modular and easier to understand. In this challenge, you will define and implement a series of simple functions that perform basic operations.
Your task is to define three functions:
add(a: i32, b: i32) -> i32
- This function should return the sum of a
and b
.subtract(a: i32, b: i32) -> i32
- This function should return the difference between a
and b
.multiply(a: i32, b: i32) -> i32
- This function should return the product of a
and b
.You need to complete these functions so that they correctly perform the specified operations.
fn
keyword followed by the function name, parameters in parentheses, and the return type.return
keyword or just the last expression in the function body to return a value.pub
keyword to make your functions public so they can be accessed from other modules.hbdo
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a:i32, b:i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32, b:i32) -> i32 { a * b}
infamous-711
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
jhq223
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32{ a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32{ a*b}
francisco-cmyk
pub fn add(a: i32, b: i32) -> i32 { return a + b}pub fn subtract(a:i32, b:i32) -> i32 { return a - b}pub fn multiply(a: i32, b:i32) -> i32 { return a * b}
xbarnett
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
arukanoido
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
oTTeuMsTudio
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b:i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}
Masber
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32, b:i32) -> i32 { a * b}
carlos-quantexai
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a:i32, b:i32) -> i32{ a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32, b:i32) -> i32{ a * b}
mk-comm
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}pub fn subtract(a: i32, b: i32) -> i32 { // Step 1: implement addition a - b}pub fn multiply(a: i32, b: i32) -> i32 { // Step 1: implement addition a * b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
nordicmachine
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { return a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { return a * b}
majesticalcreature
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
josschne
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a*b}
sander-b-postnl
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}
matei
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b:i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}
hendrikdevloed
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 {a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 {a*b}
rot11
pub fn add(a: i32, b: i32) -> i32 { a+b}pub fn subtract(a: i32, b:i32) -> i32 { a-b}pub fn multiply(a:i32, b:i32) -> i32 { a*b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
amassare
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a:i32,b:i32)->i32{ a-b}pub fn multiply(a:i32,b:i32)->i32{ a*b}
zavakid
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
victorchukwuemeka
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}pub fn subtract(a: i32, b: i32)-> i32{ a - b}pub fn multiply(a: i32, b: i32)-> i32{ a * b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
victorchukwuemeka
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}pub fn subtract(a: i32, b: i32)-> i32{ a - b}pub fn multiply(a: i32, b: i32)-> i32{ a * b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
Johnchoi913
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
MosesMp3
pub fn add(a: i32, b: i32) -> i32 { return a +b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a:i32,b:i32) -> i32{ return a-b;}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32,b:i32) -> i32 { return a*b;}
Parallaxes
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
brum-b0
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
tiagombsilva
pub fn add(a: i32, b: i32) -> i32 { return a + b;}pub fn subtract(a: i32, b: i32) -> i32 { return a - b;}pub fn multiply(a: i32, b: i32) -> i32 { return a * b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
i5-650
#[inline(always)]pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.#[inline(always)]pub fn subtract(a: i32, b: i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.#[inline(always)]pub fn multiply(a: i32, b: i32) -> i32 { a*b}
retinotopic
pub fn add(a: i32, b: i32) -> i32 { return a +b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b:i32) -> i32 { return a - b;}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b:i32) -> i32 { return a * b;}
hhornbacher
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 {a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 {a*b}
ogaca42
pub fn add(a: i32, b: i32) -> i32 { a+b}pub fn subtract(a: i32, b: i32) -> i32 { a-b}pub fn multiply(a: i32, b: i32) -> i32 { a*b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
Ustin
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { // Step 1: implement addition a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { // Step 1: implement addition a*b}
pbjarterot
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a*b}
CianciuStyles
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
ayushrawat10
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
otherJL0
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}
l3vith
pub fn add(a: i32, b: i32) -> i32 { a+b}pub fn subtract(a: i32, b: i32) -> i32 { a-b}pub fn multiply(a: i32, b: i32) -> i32 { a*b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
damascussteel21
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
agegorin
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
daanbouwman19
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply (a: i32, b: i32) -> i32 { a * b}
fuuman
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
Araden14
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { // Step 1: implement addition a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { // Step 1: implement addition a*b}
alexromanov
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
LaurentiuStoleriu
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { // Step 1: implement addition a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { // Step 1: implement addition a*b}
hanneskuettner
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a + b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { return a - b;}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b:i32) -> i32 { return a * b;}
Timepatterns
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a*b}
shbhmrzd
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a:i32, b:i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32, b:i32) -> i32 { a*b}
CountJung
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition let ret=a+b; ret}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a:i32, b:i32) -> i32{ let ret=a-b; ret}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32,b:i32)->i32{ let ret=a*b; ret}
dev-puzzler
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
oneopane
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b }// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
yurm04
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}