How does Papyrus handle if statements?

Post » Fri Sep 27, 2013 5:59 pm

If I have

if (a || b || c)

return

endif

will the code stop checking if a is true, or will it still check b and c?

User avatar
Jeremy Kenney
 
Posts: 3293
Joined: Sun Aug 05, 2007 5:36 pm

Post » Fri Sep 27, 2013 9:56 pm

I'm almost sure it will check the three conditons anyway (think I recal having checked it). Best way to do this would be:

if !a if !b  if c   return  endif else  return endifelse returnendif

Anyway, if you can be totally sure an easy way to check is to do something causing a log error in one of the checks. Something like if a == a || Game.GetGameSettingString("nothing"

The second condition will give an error in the log as nothing is not a game setting, but only if the first condition that will meet always is not enough to stop the checking.

User avatar
Isabella X
 
Posts: 3373
Joined: Sat Dec 02, 2006 3:44 am


Return to V - Skyrim