http://qs321.pair.com?node_id=181340


in reply to Logical expression style

Operator at the beginning is better for end-of-line comments--I wan't those immediatly after the thing being commented upon, not after enclosing syntax elements.

Think about column addition:

+45 -12 + 3
That makes for readable code:
$x= $principle # last month's value +$interest # interest between last payment and today -$payment # current remittence ;
That works for booleans sometimes, too.

Replies are listed 'Best First'.
Re: Re: Logical expression style
by greenFox (Vicar) on Jul 13, 2002 at 03:48 UTC

    "Think about column addition:"

    Is that because we learnt math long hand? :) I wonder if it will change as students learn math more and more on the calculator or computer...

    --
    Until you've lost your reputation, you never realize what a burden it was or what freedom really is. -Margaret Mitchell

      No, a grocery list, TODO list, and expense/income list are all instictivly written in a column. We still do that when making a spreadsheet.

      I think it's our bias to put the +/- before the item; it works just as well after:

      17.00 Credit 20.89 Debit ...
      But the common thing is that the operator and its operand are on the same line. In the infix notation used by Perl and most common languages, that means putting it on the left. In RPN-style calculators, it means putting it on the right.