What is the difference between these?
Why use one over the other?
def variable = 5
if( variable ==~ 6 && variable != 6 ) {
return '==~ and != are not the same.'
} else {
return '==~ and != are the same.'
}
In groovy, the ==~
operator (aka the "match" operator) is used for regular expression matching. !=
is just a plain old regular "not equals". So these are very different.