Please close to avoid any additional unnecessary downvoting
I'm quite shocked that I can't find this on SO so I guess my question is acceptable...
Originally, I wanted to pass multiple variables to Main from a method but it only allows one return type, so I then split the method up into two methods, returning both data types but I want to send them to Main so I can display them after being assigned in the method...
CODE
static void Main(string[] args)
{
GetID();
Console.WriteLine("Your id is {0} and your password is {1}");
}
public static int GetID()
{
Console.WriteLine("Please enter your ID");
int id = int.Parse(Console.ReadLine());
Console.WriteLine("You entered {0} as the id \t, is this correct? Y/N", id);
string response = Console.ReadLine();
switch (response)
{
case "N":
GetID();
break;
case "Y":
Console.WriteLine("Accepted");
GetPass(ref id);
break;
default:
Console.WriteLine("Incorrect answer");
break;
}
return id;
}
public static string GetPass(ref int id)
{
Console.WriteLine("Please enter your password");
string password = Console.ReadLine();
Console.WriteLine("You entered {0} as the id \t, is this correct? Y/N", password);
string response = Console.ReadLine();
switch (response)
{
case "N":
GetPass(ref id);
break;
case "Y":
Console.WriteLine("Accepted");
break;
default:
Console.WriteLine("Incorrect answer");
break;
}
return password;
}
I have come back to C# after a long hiatus and I'm quite rusty as you can tell by this simple issue, so I apologise for the low quality power of the question