For example, there is a code:

int a = Console.ReadLine(); if(a == 1) { //опред. действие } if(a == 2) { //опред. действие } if(a == 3) { //тут сделать возврат в вводу a } 
  • five
    1. read about loops 2. Your code will not even compile - you must first convert the entered value to int - DreamChild

2 answers 2

One of the possible options is an infinite loop with the break and continue operators:

  while (true) { int a = int.Parse(Console.ReadLine()); if (a == 1) { //опред. действие } else if (a == 2) { //опред. действие } else if (a == 3) { continue; } break; } 

    and better

      bool b = true; while(b) { string s = Console.ReadLine(); if(Int32.TryParse(s, out i) { switch(i) { case 1: //method b = false; break; case 2: //method b = false; break; default: Console.WriteLine("incorrect value"); break; } } else { Console.WriteLine("can't parse " + s); } }