Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Logical expression style

by John M. Dlugosz (Monsignor)
on Jul 12, 2002 at 16:48 UTC ( [id://181340]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://181340]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found