[Solved] C# and XNA display more than one text


Its still not entirely clear what behavior you want, but it seems you don’t understand what else does.

An else (or else if) statement will only execute if the if/else if statements above it do not.

With your code, this means that you will only ever execute the “A” block or the “B” block, never both.

If you just want “A” to print As and “B” to print Bs (independent of each other), just don’t use else:

if (A)
{
}
if (B)
{
}

If you only want to print Bs if you have As, then nest them:

if (A)
{
   if (B)
   {
   }
}

Honestly, I doubt you want any else structures in your current code. You do have the additional problem of checking equality on the Score variable. Score can never equal “A” and “B” at the same time, so you could never get into both conditions as it stands anyways. You’ll need to find a different condition to check.

4

solved C# and XNA display more than one text