Lets say i have this

Console.WriteLine "Enter your number or type exit and press enter to exit program";

string input = Console.ReadLine();

if (input == "exit")
{
break;
}

so my question is if you enter "exit" how do i get the console to exit? break just breaks out of the loop it is in? not exit quickly.

also if i wanted to then convert 'input' in to an integer value...is it possible to do this by explicitly converting it?

Thanks

>so my question is if you enter "exit" how do i get the console to exit?

return statement

> i wanted to then convert 'input' in to an integer value

int no;
 string input="100";
 int.TryParse(input,out no);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.