這是本文件的舊版!
如果回傳結果為TRUE或FALSE
Problem
最近在寫條件判斷時,看到類似下面寫法:
Run Keyword If | '${ret}' == 'TRUE' | xxx於是就在想,應該可以寫成這樣吧:
Run Keyword If | ${ret} | xxx所以我分享一下要怎麼調整。
How to?
最重要的就是把${ret}轉為Boolean,它是ignore case sensitive:
${ret} | Convert to Boolean | ${ret}要做判斷時,這幾種寫法都是可以使用的:
Run Keyword If | ${ret} | xxx Run Keyword If | not ${ret} | xxx Run Keyword If | ${ret} == ${true} | xxx Run Keyword If | ${ret} != ${true} | xxx Run Keyword If | '${ret}' == 'TRUE' | xxx
Reference