Shortcircuiting Test

tooltiperror

Super Moderator
Reaction score
231
Could somebody test this and post the real results? I'm not even going to try testing anything conditions related with now on a Mac :cool:

JASS:
scope PoopScope initializer onInit

//========================================
// - Testing functions, print their input
// integer and return true or false.
//
private function f takes integer i returns boolean
    call BJDebugMsg("f - " + I2S(i))

    return false
endfunction

private function t takes integer i returns boolean
    call BJDebugMsg("t - " + I2S(i))

    return true
endfunction


//========================================
// Actions
//
private function callback takes nothing returns nothing
    local boolean b
    set b = f(1) or t(1)
    set b = t(2) or f(2)
    set b = f(3) and t(3)
    set b = t(4) and f(4)
endfunction


//========================================
// True Initializer
//
private function onInit takes nothing returns nothing
    call TimerStart(CreateTimer(), 1.00, function callback, false)
endfunction

endscope
 

tooltiperror

Super Moderator
Reaction score
231
One last one, could you please check [ljass]set b = f(100) or t(100) or t(300)[/ljass]?
 

Dirac

22710180
Reaction score
147
well i guess the answer is pretty obvious when looking at laiev's pos: The rest of the conditions that share [ljass]and[/ljass] with other are ignored if one of them return false. The same applies for [ljass]or[/ljass] but instead if one of them return true

your result
f - 100
t - 100
 

Bribe

vJass errors are legion
Reaction score
67
It works as normal, what would you expect? The "or/and" keywords were never a problem it was only the "return nothing" thing which was a problem which your post has absolutely no relevance to.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top