Why am I getting the error “Expected an expression that can fail in the ‘if’ condition clause” on my code. The condition can fail, so I am lost to why I am getting this error, especially since if I put the code in my Add Death function it works. Is it because I am not changing the value of lives? Any help would be appreciated.
AddDeath():logic=
set lives -= 1
return IsLastLife()
IsLastLife():logic=
if(lives > 1):
return false
set TeamIndex -= 1
return true
AddLife(e:int): void=
if(IsLastLife()):
set TeamIndex += 1
set lives += 1