Use spaces liberally throughout your code. “When in doubt, space it out.”
In the above sentence, what does "space it out" mean?
Source: https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/#spacing
Use spaces liberally throughout your code. “When in doubt, space it out.”
In the above sentence, what does "space it out" mean?
Source: https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/#spacing
In your example
space it out
means to add spaces (or whitespaces) to make the code easier for humans to read.
Consider the difference between
def myMethod(a,b,c)if(a==b)t=0;elseif(b==c)t=a;else t=c;end;return t;end
and
def myMethod(a,b,c)
if(a==b)
t=0;
elseif(b==c)
t=a;
else
t=c;
end;
return t;
end
the nesting, using additional whitespace indentation, more clearly shows how the code will execute given different conditions. In some circumstances, behind the scenes, the additional whitespace is automatically removed (since the computer does not need it) in a process call "minification".
Your example also uses the well known construction since "doubt" and "out" rhyme
when in doubt, something it out
where something can be any verb that goes with "out" as long as the context makes sense
when in doubt, white it out (with correction fluid)
when in doubt, scream it out
when in doubt, cut it out (a possible saying by surgeons)
when in doubt, ride it out
when in doubt, wait it out
The construction
(verb) + it out
can be used to emphasize a verb in the sense to do that verb more, to do it until its maximum capacity, or to do it completely. So your example means
use more spaces
In other words, it means exactly what the first part says
Use spaces liberally throughout your code
There are other examples:
Talk it out
To talk until you are satisfied, or until you express all your burdensome emotions
Work it out
To work on a problem until it is finished or fixed
Stretch it out
To stretch something, like a muscle until it is warmed up, or a rubberband until it is about to break
Stick it out
To continue to do something to its end
There are other examples.
Further, the meaning I gave is not strict. Here is a special case.
It means to stop something completely. For example, if you are trying to study, but your little brother or sister keeps asking you to play, you might tell him or her "Cut it out!"