I wanna use a variable outside the if loop but it dosen't look good.
static void Main(string[] args)
{
int profil_num;
string Text = "1";
if (Text == "1")
{
profil_num = Convert.ToInt32(Text) - 1;
}
if (Text == "2")
{
profil_num = Convert.ToInt32(Text) - 1;
}
else
{
Console.WriteLine("Fehler");
}
Console.WriteLine(profil_num);
}
I can't print profil_num! Does anyone know why the program doesn't work
Aucun commentaire:
Enregistrer un commentaire