$wt = $ARGV[0]; $min = 1; $price = 10; while ($wt ne '') { $nwt = abs($wt); $nwt = $min if $nwt<$min; $total = $nwt*$price; $total = -$total if $wt<0; print "Price: $total\n"; print "Next Weight: "; chomp($wt = <stdin>); }
In reply to Some simple math and absolute values by sidmuchrock
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |