Break out of a loop in the main function through another function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Broko668
    New Member
    • May 2016
    • 3

    Break out of a loop in the main function through another function

    Hope the title of the question explains what I need help on.

    So here's the code that I think you'll need to understand what I'm talking about:

    Code:
    static void quit(string a, int b, ref List<string> c)
    	{
    		if (a == "-q")
    		    c.RemoveRange(b + 1, c.Capacity - b);
    	}
    
    static void Main(string[] args)
    	{
                listNums = 0
                List<string> output = new List<string>();
                loop1 = true;
    
                while (loop1)
                {
                    Console.WriteLine("\nEpisode {0}: \nEnter Authentication Code:", epiStart);
    	        authCode = Console.ReadLine();
    	        quit(authCode, listNums, ref output);
    				
    	        [B]// if (authCode == "-q")
    	    //    break; output.RemoveRange(listNums + 1, output.Capacity - listNums);[/B]
    	    }
             }
    So the question I'd be asking is this: How do I get the function "quit" to break the loop1 loop?

    The code that I commented out works, but I want to make it into a function to use it again for code later on in the program.
Working...