Right now i am learning about functions, i just have a question, i have the code below as an example of just passing a varaible (string) from one function to another, however just using a return and not declaring in the parameter. my question is what happens when you want to pass more than 1 variable from one function to another? i have the code below just to take a look at what i am doing but please let me know any suggestions, information and examples. Thank you in advance
class Program
{
static string write()
{
string mystring;
Console.WriteLine("Please enter first name");
mystring = Console.ReadLine();
return mystring;
}
static void Main(string[] args)
{
string stringer, stringer2;
stringer = write();
Console.WriteLine("Please Enter Last Name");
stringer2 = Console.ReadLine();
Console.WriteLine("Hello " + stringer + " " + stringer2);
Console.ReadKey();
}


Sign In
Create Account


Back to top









