List<string> slashesText = new List<string> { "Policies", "Tax", "-0.3f" };
if(slashesText[2] == ((-0.3f).ToString()))
{
Debug.Log("SLASHESTEXT EQUALS '-0.3f'");
}
else
{
Debug.Log("SLASHESTEXT DOES NOT EQUAL '-0.3f'; INSTEAD EQUALS '" + slashesText[2] + "'");
}
Hey! For some reason, instead of passing the if statement, it doesn't, resulting in passing through the else statement. Debug.Log message: SLASHESTEXT DOES NOT EQUAL '-0.3f'; INSTEAD EQUALS '-0.3f' These are the exact same numbers, and they're both being compared as strings. So why doesn't the if statement consider them equal? Thanks!
Aucun commentaire:
Enregistrer un commentaire