In C++, I like to break up my lines of code if they get too long, or if an if statement if there are a lot of checks in it.
if (x == 10 && y < 20 && name == "hi" && obj1 != null)
// Do things
// vs
if (x == 10
&& y < 20
&& name == "hi"
&& obj1 != null)
{
// Do things
}
AddAndSpawnParticleSystem(inParticleEffectName, inEffectIDHash, overrideParticleSystems, mAppliedEffects[inEffectIDHash], inTagNameHash);
// vs
AddAndSpawnParticleSystem(inParticleEffectName, inEffectIDHash, overrideParticleSystems,
mAppliedEffects[inEffectIDHash], inTagNameHash);
In Python, code blocks are defined by the tabs, not by the “;” at the end of the line
if number > 5 and number < 15:
print "1"
Is mutliple lines possible in python? like…
if number > 5
and number < 15:
print "1"
I don’t think this is possible, but it would be cool!
Style guide (PEP-8) says:
Method 1: Using parenthesis
Method 2: Using backslash
Method 3: Using backslash + indent for better readability