So, this question follows from a previous post, which Iβm just trying to understand completely before moving on to more complex C # materials.
My question relates specifically to the return value of a function.
Consider the following function code:
public static void DisplayResult(int PlayerTotal, int DealerTotal){
if (PlayerTotal > DealerTotal) {
Console.WriteLine ("You Win!");
Console.ReadLine ();
}
else if (DealerTotal > PlayerTotal) {
Console.WriteLine ("Dealer Wins!");
Console.ReadLine ();
} else {
Console.WriteLine ("It is a Draw!");
Console.ReadLine ();
}
I could be wrong, of course, but I believe that the keyword "void" in the first line of code means that the result of the function code does NOT return a value.
What I'm trying to understand is the function calculates the result. It distributes the text (for example: βyou win!β, Etc.) based on the result. Is the result of the function an unread value?
With my own (novelty) logic, I would think of one of two things:
- The return value of this function is a string because it is the result of a computed result.
- int, int.
, . , . - , , .