Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

5
A Question of Style
Post Body

A question of Style.

Specifically formatting If/Then/Else clauses and enclosed blocks of code.

No, I'm not trying to start a formatting war!

I am honestly curious as to what others are doing and more importantly WHY! You might even get me to change my style if your argument is good enough.

Ignoring that there are probably better ways to do the following, it's only an example to use for formatting...

The attached images of three blocks of code do exactly the same thing. If one follows the strict rules laid down by many, the third option is the preferred choice, but I find it hard to read and confusing. I find both options A and B are easier to read.

I call option A the ELSEIF version, option B - Nested If's, and option C... a mess!

I know that both VBA and PHP actually have an ELSEIF statement, but it's not really needed as ELSE IF does pretty much the same thing.

(Sorry for the images, but Reddits Code formatting SUCKS!)

https://preview.redd.it/hy30ik1wz3061.png?width=839&format=png&auto=webp&s=56fa03d11b3ce66ceae08240a5e716f154eb28b9

https://preview.redd.it/t257g8p204061.png?width=1008&format=png&auto=webp&s=adffa36a8d4a6e18ce84c6d47506dcdb7f3c82ea

https://preview.redd.it/jb3mqgk704061.png?width=935&format=png&auto=webp&s=6abb5f5707eea95d8159b3cdb2d7f9d4c4cd52d7

What is your choice, or would you do it a different way?

Don't forget to say WHY!

Author
Account Strength
100%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
55,295
Link Karma
11,725
Comment Karma
42,740
Profile updated: 1 day ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago