Lets say I have some variables that evaluate to either true or false:
firstValue = true
secondValue = false
thirdValue = true
And I put them in a list:
def list = [firstValue, secondValue, thirdValue]
I want to iterate through the list and check if each value returns true or false, if the value is true I want to be able to print the name i.e. firstValue
for (item in list){
if (item == true){
println("${item} is true")
}
}
This is just printing "true is true"