Right and Left Coding Styles
September 15th 2007 20:12
When writing software you can take different approaches to solving problems. Here is an example (I'll explain the code after the main article) of how a left winger and right winger may handle a simple everyday problem.
Before anyone goes at my throat, heres how I'd solve this problem:
As for the solution I would be proposing? Well I can tell you for a fact that it would recquire much more coding than what is shown. It certainly won't be as simple as manipulating numbers and calling it a day.
Bool is a true false thing, the returns you see show what this function returns when called. So if someone calls PeaceEstablished() from anywhere in the code they get a return value of true or false depending on whats going on.
One '=' sign means your making something equal something, for instance bool x can be assigned a value of true as follows: x = true. On the other hand the '==' is a comparance, for instance 3 == 3 returns true because 3 does equal 3.
/= means 'divide by', so x /= 3 is the same as x divided by 3 and the result is stored in x. So if x is 1 then x /= 3 means x will be 1/3 now. *= is 'multiply by', so x *= 3 is the same as x * 3 and x *= 3 where x is 1 means x will have a value of 3.
Before anyone goes at my throat, heres how I'd solve this problem:
As for the solution I would be proposing? Well I can tell you for a fact that it would recquire much more coding than what is shown. It certainly won't be as simple as manipulating numbers and calling it a day.
Bool is a true false thing, the returns you see show what this function returns when called. So if someone calls PeaceEstablished() from anywhere in the code they get a return value of true or false depending on whats going on.
One '=' sign means your making something equal something, for instance bool x can be assigned a value of true as follows: x = true. On the other hand the '==' is a comparance, for instance 3 == 3 returns true because 3 does equal 3.
/= means 'divide by', so x /= 3 is the same as x divided by 3 and the result is stored in x. So if x is 1 then x /= 3 means x will be 1/3 now. *= is 'multiply by', so x *= 3 is the same as x * 3 and x *= 3 where x is 1 means x will have a value of 3.
| 45 |
| Vote |
subscribe to this blog

















Comment by yoda76
The Tube Blog