CommunityNews

CommunityNews

Avoid Yoda conditions in Perl you should

Avoid Yoda conditions in Perl you should—The Phoenix Trap.
Assign not when mean to compare you do. Help you warnings and strictures can.

Read in full here:

https://phoenixtrap.com/2021/12/28/avoid-yoda-conditions-in-perl-you-should/

This thread was posted by one of our members via one of our news source trackers.

Most Liked

davearonson

davearonson

Not just Perl; this used to be fairly common in C. Eventually we developed the convention that if you really did mean to assign and compare the results of that, as in if (c = getc()) you would wrap it in an extra set of parentheses, like if ((c = getc())). Then, the compiler would use that as a “yes I really meant to do that” signal.

On the other claw, Perl never was exactly famous for readability…

Where Next?

Popular Backend topics Top

New
New
First poster: bot
As I continue to work on Cyberscore, I keep finding new quirks / features in PHP and MySQL. All of the tests below are being run on mysql...
New
First poster: bot
Why Lisp? A lot of people ask us the question, why do we choose to use Common Lisp as our primary development language? Often times the q...
New
New
First poster: bot
Ruby: How to Run a Rack app in a Background Thread. Stubbing and mocking are fine, but sometimes you want to test full integration. This...
New
CommunityNews
Letting Go of Random. In a recent post I shared some thoughts about art and included a few, somewhat tongue-in-cheek comments about the ...
/go
New
First poster: OvermindDL1
GitHub - deadpixi/wasm-maze-generator: A simple WASM maze generator in Go. A simple WASM maze generator in Go. Contribute to deadpixi/wa...
New
First poster: bot
GitHub - clojure-rs/ClojureRS: Clojure, implemented atop Rust (unofficial). Clojure, implemented atop Rust (unofficial). Contribute to c...
New
First poster: faust
Ruffle is a Flash Player emulator written in Rust. Ruffle runs natively on all modern operating systems as a standalone application, and ...
New

Other popular topics Top

New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File > New Rule: And select Deny, O...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
PragmaticBookshelf
Develop, deploy, and debug BEAM applications using BEAMOps: a new paradigm that focuses on scalability, fault tolerance, and owning each ...
New