How will I break the loop if a particular condition is satisfied?
My input file has around n number of lines. If the required information is got at some mth line I need to break the loop instead of reading the remaining lines.
new File("test.txt").readLines().reverseEach{line ->
println line
if(line.contains("Data"))
break;
}