Skip to content

Commit

Permalink
Merge pull request #247 from mknos/bc-if-false
Browse files Browse the repository at this point in the history
bc: don't print 0 for a false if-condition
  • Loading branch information
briandfoy authored Sep 28, 2023
2 parents 850753e + 3a12323 commit 31fc05c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/bc
Original file line number Diff line number Diff line change
Expand Up @@ -2533,10 +2533,11 @@ sub exec_stmt
# IF statement

my $cond = pop @ope_stack;
$val = 0;
if($cond) {
($return, $val) = exec_stmt($instr->[1]);
push(@ope_stack, $val), last INSTR if $return;
} else {
$val = undef;
}

# debug {"IF: $val.\n"};
Expand Down Expand Up @@ -2619,7 +2620,6 @@ sub exec_stmt
# Restore the symbols temporarily pushed in 'a' and 'A' instructions
debug {"restoring backup: ".Dumper(\@backup_sym_table)};

my $n;
# pop @backup_sym_table; # The first is undef
while($var = pop @backup_sym_table) {
debug {"restoring var: ".Dumper($var)};
Expand Down

0 comments on commit 31fc05c

Please sign in to comment.