#Short-circuit evaluation | Interpreter Upgrade

1 messages · Page 1 of 1 (latest)

subtle dome
#

I did small test. I always order arguments by heavy load so "Short-circuit evaluation" can increase performence.

function @test1():number
    print("1")
    return 0

function @test2():number
    print("2")
    return 1

init
    if @test1() and @test2()
        print("OK")

In this case @test2 should not be called because @test1 return 0
unfortunately @test2() is called also

    array $test1:text

    if $test1.size and $test1.0 == "A"
        print("OK")

Here we have Invalid Array Indexing....

    array $test1:text

    $test1.append("A")
    if $test1.size and $test1.0 == "A"
        print("OK")

No errors after append

keen gulch
plucky sun
#

$test1.0 == "A" shouldn't get evaluated

keen gulch
#

Ah my bad, I somehow skipped this showcase and thought the "invalid array indexing" is supposed to be for what's written below it.

plucky sun
#

So did I at first 😅