cant you simply place all the units in one array and then all the variables you want to check in another array, and then check if x is true for each of Y
and for those variables that arent booleans, simply make a boolean out of them
for instance
?(_unit distance _location <100): Iamclose = true