+ 1
Can we use two return values in a function?
If we need to check whether a number is even or odd. By using functions can we use two return statements by using if-else statement. Like: If(x==0) return(x); Else return (x);
4 Respostas
+ 1
Yes you can. It's like returning two different values, one at a time, based on a condition.
But remember, you cannot return multiple values. For that you have to use other methods like aggregate data types or output parameters.
+ 2
yes ,absolutely :)
+ 1
anjit pariyar Thank you😊
0
Deepesh Choudhary Thank you...
Yes I know that I can not return multiple values.. but I m returning only one value.. if condition became true then it will return first value and if condition became false it will return the second value..
Thank you