User Tools

Site Tools


tutorials:faq:main

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorials:faq:main [2020/10/19 19:20] micondatutorials:faq:main [2021/04/03 06:15] miconda
Line 613: Line 613:
 if($var(x) == 0) { if($var(x) == 0) {
   # do something   # do something
 +}
 +</code>
 +
 +To compare the return code of a function with a number is recommended to use the value stored in $rc, because the priority of the operators can convert function return code to internal-true or internal-false. Therefore the next approach should be used:
 +
 +<code c>
 +function_returns_four();
 +$var(rc4) = $rc;
 +if($var(rc4)==4) {
 +   # it goes here
 +} else {
 +   # it doesn't go here
 +}
 +...
 +function_returns_two();
 +$var(rc2) = $rc;
 +if($var(rc4)==$var(rc2)) {
 +   # it doesn't go here
 +} else {
 +   # it goes here
 } }
 </code> </code>
tutorials/faq/main.txt · Last modified: 2021/08/27 06:11 by miconda

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki