jrliv
6/10/2017 - 10:34 PM

Example of how to read and print a string using a method.

Example of how to read and print a string using a method.

static void PrintArtist()
{
  Console.Write("Enter your favorite music artist: ");
  string artist = Console.ReadLine();
  Console.WriteLine();
  
  Console.WriteLine("Your favorite music artist is: " + artist);
}

static void Main(string[] args)
{
  PrintArtist();
}

//  Enter your favorite music artist: Nirvana
//  
//  Your favorite music artist is: Nirvana