Forum Discussion
nmrao
Champion Level 3
Not clear.
What you actually looking for?
You may look at documentation below
https://groovy-lang.org/semantics.html#_if_else
What you actually looking for?
You may look at documentation below
https://groovy-lang.org/semantics.html#_if_else
_ivanovich_
6 years agoFrequent Contributor
OK so see the follwing example:
It should fail for me but it doesn't
try{
def b = 14
def a =1
if(a == '2'){
assert a == b
}
}catch (AssertionError e)
....
- _ivanovich_6 years agoFrequent Contributor
ok i found my problem, it works without try catch block .
- nmrao6 years agoChampion Level 3should it not be a==2 instead?
- _ivanovich_6 years agoFrequent Contributor
Yes Rao.
But in my code there were more problems because some data were string and some not, so i first remove the try catch block then i convert my data correctly and i just use the if else and assert. it works well for what i was looking for. Sorry for all mistakes.
Related Content
- 4 years ago
- 2 years ago
Recent Discussions
- 15 years ago