perladvent / perldotcom

The source code for Perl.com website
https://www.perl.com
77 stars 80 forks source link

Fixed code example for ternary operator #340

Closed stollr closed 1 year ago

stollr commented 1 year ago

The code example for standard if-else was not really equivalent to the example where the ternary operator was used. The additional $salary variable is not needed.

If you like this PR I'd be happy if you would merge it or label it with hacktoberfest-accepted. Thanks in advance.

briandfoy commented 1 year ago

There's not a ternary operator here, and this is a bit of a stylistic issue that I'd rather not edit away. Some people like single points of return (I'm not one of those). I don't see a substantial improvement here, so I'm declining this.

stollr commented 1 year ago

You are right. The title of the PR is misleading. The changed code is the equivalent of the ternary operator. In the example for the usage of the ternary operator, there is a single point of return. So I thought the equivalent should follow that.

But nevermind.