Index array using boolean result of a comparison

Thank you. This makes sense. Code now sorted and everything working fine.