« first day (4024 days earlier)      last day (931 days later) » 

12:00 AM
Between infinite and short there is a big difference. -- G.H. Gonnet (source)
 
 
3 hours later…
3:19 AM
hums a song
 
 
4 hours later…
7:26 AM
@user2995458 Assuming that Groovy's natural string ordering understands version numbers. Run this snippet for example:
def C = ['1.0', '1.6', '1.7', '1.7.1', '1.10.0', '1.11.0', '1.12']
C.sort()
println(C)
For your code to work the way you expect it, the output would have to be identical to the definition of C, it isn't though, it's [1.0, 1.10.0, 1.11.0, 1.12, 1.6, 1.7, 1.7.1] because the sorting is done character by character and not number by number (i.e. 6, 7, 10, 11, 12)
So B >= item is true for [1.0, 1.10.0, 1.11.0, 1.12, 1.6, 1.7] and A <= item is true for [1.12, 1.6, 1.7, 1.7.1] with the only common ones being 1.6, 1.7 and 1.12 (running your code also printed "deploy the version 1.6" which is missing in your snippet but I took the code as source of truth).
So how to fix that? If you have control over the ordering of C, you can use the indices (I am not familiar with Groovy best practices so I just hacked this together):
def C = ['1.0', '1.6', '1.7', '1.7.1', '1.10.0', '1.11.0', '1.12']
A = C.indexOf('1.12')
B = C.indexOf('1.7')
I = 0

for (item in C) {
  if (A >= I && B <= I) {
    println "deploy the version ${item}"
  }
  I++
}
So now instead of relying on the string ordering, we rely on the ordering of the original list, counting up an index variable inside the loop and if the current index is between or equal to the indices of the versions we want to deploy, we print that.
If you don't have control over the initial ordering of C, the best solution would be to write a comparator to order the list correctly or to use a library that understands version strings to do that
 
 
5 hours later…
12:33 PM
posted on October 29, 2021

archive - contact - sexy exciting merchandise - search - about ← previousOctober 29th, 2021nextOctober 29th, 2021: On the other hand I sincerely believe most people think "MAN I wish I'd read more comics" so you're ALREADY ahead of the game!!– Ryan

 
 
3 hours later…
3:08 PM
@Zoe ggz on mod
 
Zoe
thanks ^^
 
 
5 hours later…
8:11 PM
 

« first day (4024 days earlier)      last day (931 days later) »