You need a function to run. The functions are as follows:
<access modifier> <return type> <Name> ( <parameters> ) {}
Quick example:
private bool GetResult (int playerValue, int dealerValue) { }
This means that the function will return bool and require two int parameters. To return nothing, return the void. To call a function, use its name and pass the parameters in parentheses:
bool result = GetResult(1, 2);
Now, to perform the comparison, we use the if statement:
if (<expression> <comparator> <expression>) {}
Another quick example:
if (playerScore > dealerScore) { Console.WriteLine("Player wins!"); }
That says: “If PlayerScore is larger than DealerScore, do what is inside the bracket” (print in this case).
I am trying to explain the basics, instead of giving a real answer, as you requested. Please let me know if I can clarify anything better, and good luck with C # programming!
Bradleydotnet
source share