Following the code below, my intention was to randomize the switch to choose between case 1 and 2 after receiving the word "gamble". It turns out that when I type gamble, only case 1 (add 10 irons) is activated, instead of being random between adding 10 or subtracting 10. What did I do wrong?
int ferros;
string gamble;
gamble = Console.ReadLine();
Random rnd = new Random();
int luck = rnd.Next(1,3);
bool loop = true;
while (loop)
{
if (gamble == "gamble")
{
switch (luck)
{
case 1:
ferros = ferros + 10;
break;
case 2:
ferros = ferros - 10;
break;
}
}
}