The source code to create a simple function is given below. The given program is compiled and executed successfully.
// Rust program to create a
// simple function
fn SayHello(){
println!("Hello World");
}
fn main() {
SayHello();
}
Output:
Hello World
Explanation:
In the above program, we created two functions SayHello() and main(). The SayHello() function is a user-defined function to print the "Hello World" message.
In the main() function, we called SayHello() function and printed the "Hello World" message.
Program/Source Code:
The source code to create a simple function is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we created two functions SayHello() and main(). The SayHello() function is a user-defined function to print the "Hello World" message.
In the main() function, we called SayHello() function and printed the "Hello World" message.
need an explanation for this answer? contact us directly to get an explanation for this answer