Does this work?

 if(mapString:=mapVotedFor[Player]?):
              #do stuff
          else:
            set votesForMap1 += 1
            UpdateUI() 

If the value in mapVotedFor[Player] is false (doesn’t exist) it runs what’s in else: right? Because that’s what I’m trying to do

Do it without the question mark

1 Like

I supposed that’s gonna make it work but could you explain why? Cus Im pretty sure that when i put the ? it means that it returns false if no value is there

Hi,
If you call and it returns false, then it will fail. False = fail and jump to else. So no need to query it.
If it returns with any value other than false, it will succeed, and code will proceed underneath the IF block.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.