Call a variable

I want to call a variable when x is more than 100, like:

-- Use this function to perform your initial setup
function setup()
    print("Hello World!")
    x=50
    Test(bol())
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)

    -- This sets the line thickness
    strokeWidth(5)

    -- Do your drawing here
    
end

function Test(call)
    if x>100 then
        call()
    end
end

function bol()
    print("Yes!")
end

This will call the variable when x is bigger than 100, but it isnt. The variable is called even if x is 50. How do I fix?

There is a syntaxt error

Sorry that I dont understand. What do you mean?

You wrote

function setup()
    print("Hello World!")
    x=50
    Test(bol())
end

But it should be

function setup()
    print("Hello World!")
    x=50
    Test(bol)
end

This should work

Yeah, it did! Thanks! :slight_smile: