I have a bash function, whic role is to receive an array, loop thru the array and call another function is_node that check if an node element exist. 
If a node element exists `is_node' returns 0, if trows an error returns a number between 1-6, otherwise returns 7 or above.
My issue with is_nodes is even if 'is_node' return 0 will return 7
! return 7, should be triggered if no error appears and no nodes exists
 function is_nodes() { 
    local arr=("$@")    
    for node in ${arr}
    do
        is_node $node 
        if [[  $? -gt 0 && $? -lt 7  ]]
        then
            return 2
        elif [[ $? -eq 0 ]]
        then
            return 0
        fi  
    done
    # default
    return 7
}
pesudeo-code
is_nodes receive an array (node1 node2 node3)
loop
  is_node node1 triggers an error ?; no go further
  is_node node1 exists(return 0) ?; no continue   
  is_node node2 triggers an error ?; no go further
  is_node node2 exists(return 0) ?; yes get out of the function and return 0
 
    