Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Any finite loop on machine instructions looks like a condition check + conditional jump.
In general, the same goto wrapped in a beautiful wrapper.
So for the processor there is no difference. It is for the person who will read/maintain the program, so write the code as if it would be accompanied by a bloodthirsty psychopathic maniac who knows where you live.
Make your code clear and readable.
var ret = true;
do
{
var key = Console.ReadKey().KeyChar;
if (key == 'a')
{
_replaceMode = ReplaceMode.Override;
ret = false;
}
if (key == 'b')
{
throw new ArgumentException($"File exist, breaking: {newWikiPageUrl}");
}
if (key == 'r')
{
ret = false;
}
} while (ret);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question