Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bc: don't print 0 for a false if-condition
* perl bc evaluates false "if" as an expression and returns 0, not "null" >>> if (0 == 1) { a = 1; } 0 * This doesn't happen if the condition is true * I observe that if $res==0, the executed statement result ($val) is printed * In IF-statement code, $val is returned by exec_stmt() if the condition is true * If the condition is false, $val defaults to zero but this causes an unwanted print later * Changing the default to undef works for some simple bc scripts with * Reading the code, I see other examples of undef being pushed into ope_stack, so I think this will not corrupt the state * Also remove unused variable $n found by perlcritic
- Loading branch information