Example:
Code: Select all
do
{
Something();
}
while (something);
Code: Select all
do
Something();
while (something);
Moderator: Coders of Rage
Code: Select all
do
{
Something();
}
while (something);
Code: Select all
do
Something();
while (something);
Code: Select all
#include <iostream>
#include <cstdio>
class SomeClass {
bool quit;
public:
SomeClass();
void Something();
bool getQuit();
};
SomeClass::SomeClass()
{
quit = false;
}
void SomeClass::Something() {
printf("strange");
}
bool SomeClass::getQuit() {
return quit;
}
SomeClass SomeClass1;
int main()
{
do
SomeClass1.Something();
while (!SomeClass1.getQuit());
}
Code: Select all
if() something;
else something;
AgreedGyroVorbis wrote:It's just as fine as doing:Some programmers don't like that and always use curly braces for one-liners, but I think that's just being anal. If you asked me, I would say it's perfectly legit.Code: Select all
if() something; else something;
Yeah, it's legit, but I personally put braces just because it's easier for me to see a problem.GyroVorbis wrote:It's just as fine as doing:Some programmers don't like that and always use curly braces for one-liners, but I think that's just being anal. If you asked me, I would say it's perfectly legit.Code: Select all
if() something; else something;
ThisXianForce wrote:Yeah, it's legit, but I personally put braces just because it's easier for me to see a problem.GyroVorbis wrote:It's just as fine as doing:Some programmers don't like that and always use curly braces for one-liners, but I think that's just being anal. If you asked me, I would say it's perfectly legit.Code: Select all
if() something; else something;
I do this as well. I often add lines of debug code to my conditionals, and that never ends well if you didn't use braces for the one-liner. It also improves readability (for me).hurstshifter wrote:ThisXianForce wrote:Yeah, it's legit, but I personally put braces just because it's easier for me to see a problem.GyroVorbis wrote:It's just as fine as doing:Some programmers don't like that and always use curly braces for one-liners, but I think that's just being anal. If you asked me, I would say it's perfectly legit.Code: Select all
if() something; else something;
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
This.hurstshifter wrote:ThisXianForce wrote:Yeah, it's legit, but I personally put braces just because it's easier for me to see a problem.GyroVorbis wrote:It's just as fine as doing:Some programmers don't like that and always use curly braces for one-liners, but I think that's just being anal. If you asked me, I would say it's perfectly legit.Code: Select all
if() something; else something;
I'm just being a dick.Master Jake wrote:Thanks everyone.
By the way, newbie1234, what's all this about a "must be" object orientation. The language doesn't force me to use it so why should I when I don't need to?
I use something similar, but it helps me differentiate the condition and action:GyroVorbis wrote:It's just as fine as doing:Some programmers don't like that and always use curly braces for one-liners, but I think that's just being anal. If you asked me, I would say it's perfectly legit.Code: Select all
if() something; else something;
Code: Select all
if()
something;
else
something;
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
I use that method too, but I also put an additional space between the if, else-if, and else statements like:Ginto8 wrote:Code: Select all
if() something; else something;
Code: Select all
if (conidition)
result;
else if (condition)
result;
else
result;