Hi.
I use Katalon recorder
Why this not work?
if 3<2 {
echo bad
}
else
{
echo good
}
return:
bad
good
Hi.
I use Katalon recorder
Why this not work?
if 3<2 {
echo bad
}
else
{
echo good
}
return:
bad
good
OMG. I see what happened. how to check ${string} == ${string} ?. This return value in ${string} is not defined
Hi,
first you have to create variable named “string” to be able to compare that to something, use one of the command which start with “store”. If you want to compare strings you can use store command to create one - it will be string value in the Variables tab, for number use storeEval. If you want to take text from page use “storeText” command and then you can compare almost like you wrote it, so it would be like:
“${string}” == “${string2}”
in target of “if” command.
If you want to compare numbers/strings like on your screenshot so it’s not a variables dependend on website content it looks like it have no sense because it will always give same result.
To help with your first question, you have missed off the final endIf
if | 3 < 2 | |
echo | bad | |
else | | |
echo | good | |
endIf | | |
Here’s the Log
[info] Executing: | if | 3 < 2 | |
[info] Executing: | echo | bad | |
[info] Executing: | else | | |
[info] Executing: | echo | good | |
[info] echo: good
[info] Executing: | endIf | | |