Click here to Skip to main content
15,893,588 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Which do you prefer? A programming question! PinPopular
Kschuler1-Jul-21 10:00
Kschuler1-Jul-21 10:00 
GeneralRe: Which do you prefer? A programming question! Pin
peterkmx1-Jul-21 11:40
professionalpeterkmx1-Jul-21 11:40 
GeneralRe: Which do you prefer? A programming question! Pin
Marc Clifton1-Jul-21 12:34
mvaMarc Clifton1-Jul-21 12:34 
GeneralRe: Which do you prefer? A programming question! Pin
Jon McKee1-Jul-21 11:01
professionalJon McKee1-Jul-21 11:01 
GeneralRe: Which do you prefer? A programming question! Pin
CodeWomble1-Jul-21 12:06
CodeWomble1-Jul-21 12:06 
GeneralRe: Which do you prefer? A programming question! Pin
Marc Clifton1-Jul-21 12:35
mvaMarc Clifton1-Jul-21 12:35 
GeneralRe: Which do you prefer? A programming question! Pin
Mircea Neacsu1-Jul-21 14:29
Mircea Neacsu1-Jul-21 14:29 
GeneralRe: Which do you prefer? A programming question! Pin
Wizard of Sleeves1-Jul-21 20:51
Wizard of Sleeves1-Jul-21 20:51 
There are only three acceptable reasons for creating a function:

1. If there is more than one occurrence of the segment of code.

2. It makes reading the code more logical.
JavaScript
if(itShouldBeDone(foo)) {
	doSomething()
}

3. to confuse the next poor soul who gets to work on your code.
JavaScript
function itShouldBeDone(foo){
	return decideWhatToDo(foo);
}

function decideWhatToDo(foo){
	let decision= false;
	if(typeof foo == "boolean") {
		switch(foo){
			case true:
				decision= foo;
				break;
			case false:
				decision= !foo;
				break;
			default:
				decision= true;
		}
	}
	return false;
}

Nothing succeeds like a budgie without teeth.

GeneralRe: Which do you prefer? A programming question! Pin
KateAshman1-Jul-21 21:02
KateAshman1-Jul-21 21:02 
GeneralRe: Which do you prefer? A programming question! Pin
CPallini1-Jul-21 21:10
mveCPallini1-Jul-21 21:10 
GeneralRe: Which do you prefer? A programming question! Pin
rob tillaart1-Jul-21 21:40
rob tillaart1-Jul-21 21:40 
GeneralRe: Which do you prefer? A programming question! Pin
den2k881-Jul-21 21:48
professionalden2k881-Jul-21 21:48 
GeneralRe: Which do you prefer? A programming question! Pin
Private Dobbs1-Jul-21 21:54
Private Dobbs1-Jul-21 21:54 
GeneralRe: Which do you prefer? A programming question! Pin
YahiaEQ2-Jul-21 0:35
YahiaEQ2-Jul-21 0:35 
GeneralRe: Which do you prefer? A programming question! Pin
Delphi.7.Solutions2-Jul-21 1:11
Delphi.7.Solutions2-Jul-21 1:11 
GeneralRe: Which do you prefer? A programming question! Pin
Kirk 103898212-Jul-21 2:18
Kirk 103898212-Jul-21 2:18 
GeneralRe: Which do you prefer? A programming question! Pin
Gary Wheeler2-Jul-21 3:04
Gary Wheeler2-Jul-21 3:04 
GeneralRe: Which do you prefer? A programming question! Pin
Reelix2-Jul-21 5:35
Reelix2-Jul-21 5:35 
GeneralRe: Which do you prefer? A programming question! Pin
sasadler2-Jul-21 6:20
sasadler2-Jul-21 6:20 
GeneralRe: Which do you prefer? A programming question! Pin
charlieg2-Jul-21 11:49
charlieg2-Jul-21 11:49 
GeneralRe: Which do you prefer? A programming question! Pin
r_hyde2-Jul-21 12:05
r_hyde2-Jul-21 12:05 
GeneralRe: Which do you prefer? A programming question! Pin
Gerry Schmitz2-Jul-21 19:11
mveGerry Schmitz2-Jul-21 19:11 
GeneralRe: Which do you prefer? A programming question! Pin
Martin ISDN3-Jul-21 3:19
Martin ISDN3-Jul-21 3:19 
GeneralRe: Which do you prefer? A programming question! Pin
AnotherKen3-Jul-21 17:55
professionalAnotherKen3-Jul-21 17:55 
GeneralRe: Which do you prefer? A programming question! Pin
rjmoses4-Jul-21 0:40
professionalrjmoses4-Jul-21 0:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.