Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Logical expression style

by John M. Dlugosz (Monsignor)
on Jul 12, 2002 at 16:48 UTC ( #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? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2022-08-17 19:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?