I am trying to check if a float is a whole number, by using:
if(birthMonth == 2 && birthYear / 4 != int.Parse(birthYear))
{
birthDay = UnityEngine.Random.Range(1, 28);
}
But I get the following error:
Assets/scripts/Birthdays.cs(39,68): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
What should I do to fix this?
767_2
October 2, 2014, 4:18pm
2
test this
if( (birthMonth == 2) && ( (birthYear / 4) != (int.Parse(birthYear)) ) )
{
birthDay = Random.Range(1, 28);
}
Sorry everyone, it was a problem with a different line that caused error CS0201, and upon fixing it I was shown with some more errors. For future reference, I changed the if statemet to:
else if(birthMonth == 2 && (birthYear/4) != Mathf.Round(birthYear/4))
{
birthDay = UnityEngine.Random.Range(1, 28);
}