Thread: Tech Tip for coders
View Single Post
Old 12-31-2020, 08:55 AM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,078
Quote:
Originally Posted by 8pt-buck View Post
"else" really isn't needed after every "if" ..
I can give you a bunch of examples ...

Personally.. it would make a mess of the code to write to write a empty else after every if.
You don't always need a final else ...

I think most programmers are well aware of that but it is worth repeating for any newbs out there.

With that said, many of us refer to the conditional structure as "if then else" whether there is a literal else indicated or not. Not putting an else says to do nothing:

if this condition then do this else do nothing

is the same as

if this condition then do this

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote