Ethan Merritt - 2023-05-17

I think that is about the only way in version 5.
In version 6 you will be able to use a function block to reduce that to a single test:

function $Exists(foo) << EOF
    local B = 1
    eval( "B = ".foo )
    return exists("B")
EOF

array A[3]
A[2] = "two"

do for [x in "A[1] A[2] A[3]"] {
    if ($Exists(x)) { print x, " exists" }
    else { print x, " does not exist" }
}

[~/temp] gnuplot E.gp
A[1] does not exist
A[2] exists
A[3] does not exist