+ 3
What does return mean and what does it do
Can someone please explain return
7 Answers
+ 10
return is used for return values after some execution to where the function is called,
you can use return 0; to return nothing
and yeah if you have some function and with return type int then it will the value which is type integer.
+ 8
I thought return is just return in c#. the value is optional.
this is my understanding and please correct me if I am incorrect
When we want to return an int( lets say 5 ). We think of it as return to the place of execution with an "int".
not return this "int" to the place of execution
+ 7
"return" :verb: Go back to. --- returns to the place of execution.
+ 7
COMPL3X , Good explanation
+ 5
return means to give back a value.
+ 5
Look at this code: (Rust)
fn main() {
println("{:?}", say("Hey")); //Calling the say function. Ofcourse, you need to print it, as return only returns a value not print it.
}
fn say(txt) {
txt //Doing this without semicolon means implicit return type in Rust
}
+ 2
Thanks