I often use the logical operators && || and or as stand-ins for if (){};. Their short-circuit behavior is a handy idiom for conditionals.

I sometimes struggle with how to pronounce them. I always say 'and' and 'or' to myself and I know what I mean. How can they be said to others?

In English, 'do{} or die' is correctly understood by everyone. This extends to most ..or die; constructions in perl. The trouble is that it's the 'die' part that is recognised. The logical structure is swamped by the cliche.

A m// && print; sequence is second nature to perl programmers. What do you say when you read it out loud to nonperlers? To sugarcoat plain "match and print", I've used:

  1. "match forces print"
  2. "match means print"
  3. "match induces print"
  4. "match implies print"
None of those are very natural.

When the predicate is just a flag, it's helpful to make it a gerund or noun ( $production || $debugging && print;), but what verbs make the meaning of that clear in spoken language?

I wonder whether other languages provide more precision in these matters, too

After Compline,
Zaxo


In reply to Spoken Perl: and || && or what? by Zaxo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.