Mutating function parameters

Take a look at the Ref type (C Interface · The Julia Language these docs appear a bit cryptic on first read, a better mental model is given by What is Ref? - #14 by Oscar_Smith). You can use it like

using DataFrames

function doit!(flag::Ref, df)
    if flag[]==true
        flag[]=false
    end
    if df[1, :flag]==true
        df[1, :flag]=false
    end
    println("Within doit, flag=",flag[],", df=",df[1, :flag])
end

function main()
    df = DataFrame(flag = [true])
    flag[]=true
    for i = 1:2
        println("$i - Before,  flag=", flag[], ", df=", df[1, :flag])
        doit!(flag, df)
        println("$i - After,   flag=", flag[], ", df=", df[1, :flag])
    end
end

main()