So I'm going to simplify an assignment I'm working on. I'm sorry if it's crazy bad I'm very new to C#. I should add that the finalMethod call is within Main() and is the only thing in Main().
finalMethod(ifPossible(functionOne()), functionTwo()))
static int functionOne()
{
int number;
Console.WriteLine("Enter a number: ");
number = int.Parse(Console.ReadLine());
return number;
}
static int functionTwo()
{
int number;
Console.WriteLine("Enter a number: ");
number = int.Parse(Console.ReadLine());
return number;
}
static bool ifPossible(int x, int y)
{
if (x < y)
{
return true;
}
else
{
return false;
}
}
static int finalMethod(bool x)
{
if (x == true)
{
Console.Write("Success");
}
else
{
Console.Write("Fail");
}
}
My problem is that I need to return the int values from the first two functions into the finalMethod function. This is probably going to require a lot of restructuring but any help would be greatly appreciated.
ifPossible()fromfinalMethod()and just pass bothxandytofinalMethod()? There are numerous answers on Stack Overflow already discussing how to return multiple values from a single method, but it doesn't really seem like that's even needed here. What have you tried? What specifically did you have trouble with?