Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: defined || undefined  (Read 1482 times)

0 Members and 1 Guest are viewing this topic.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
defined || undefined
« on: 06 Jul 2007, 12:33:16 »
Take care of that, as these sentences will return false always:

_a = true
?_a || _b: hint "at least one of them is true"

You will never get the hint as _b is undefined.

_a = true
_b = false
?_a || _b: hint "at least one of them is true"

This time you will get the hint.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: defined || undefined
« Reply #1 on: 06 Jul 2007, 15:24:09 »
That is why we need short circuit and and or in ArmA, a suggestion I made on the BI forums...
Kegety did post a workaround for xor:
Code: [Select]
if({_x}count[A, B] == 1) then {
   // true
} else {
   // false
};

Would the following work for your case i.e. _a and _b possibly undefined?:
Code: [Select]
if  ({_x} count [_a,_b] > 0) ...
urp!