View Full Version : How do you code?
Wrycu
10-13-2008, 08:01 PM
Choice 1:
if (condition)
{
//do stuff
}
Choice 2:
if (condition){
//do stuff
}
Edit:
And why?
ShowerThoughts
10-13-2008, 08:06 PM
I code C# it's similar I took option 1
Runescapian321
10-13-2008, 08:08 PM
Option 1. It's easier to read that way IMO, even if it does take up extra space.
Buckleyindahouse
10-13-2008, 08:08 PM
Option 1. It's easier to read that way IMO, even if it does take up extra space.
What he said an also because Visual Studio automatically formats it to that :D
Method
10-13-2008, 08:14 PM
I do option #2 because it looks better than option #1. I've never had problems with indenting, really, so that works for me.
Yakman
10-13-2008, 10:45 PM
they have names,
option1 and option2 are called Allman and K&R style respectively. (I'm fairly sure i got the right ones....)
i like K&R, simply because thats how i learnt it
i get my inspiration from this quote from a book
The position of braces is less important, although people hold passionate beliefs. We have chosen one of several popular styles. Pick a style that suits you, then use it consistently.
Bobarkinator
10-14-2008, 03:35 AM
I used to use Allman religiously, but I have recently switched back to K&R because it's better to code officially in my opinion. Except in SCAR lol :p. I don't follow many scar standards any more :p
Tniffoc
10-15-2008, 02:56 AM
For me, it depends on the language. Op #1 for C/C++ and Op #2 for Java! :D
Wrycu
10-16-2008, 01:46 PM
Cool. I keep seeing scripts that use option 2, and I find it really annoying.
Negaal
10-17-2008, 11:04 AM
1#, and this thread is stupid.
TravisV10
10-17-2008, 11:23 AM
I use option 2 b/c that is what is usually used with other languages I use. Plus it is easier to read because you don't make a ton of extra lines.
2 seems to be the logical way to write code.
Freddy1990
10-19-2008, 02:24 PM
if (condition) {
//do stuff
}
BlackThursday
10-19-2008, 07:30 PM
Option 1. It's how I learned to code PHP and since that's embedded in my brain now, thats probably how I'll code forever.
R0b0t1
10-19-2008, 11:40 PM
I make one line programs.
Harry
10-19-2008, 11:42 PM
You forgot
if (condition) { stuff(); }
I am all for Allman though :)
Smartzkid
10-24-2008, 08:10 PM
K&R all the way
Enchanted
10-27-2008, 11:46 AM
I personally do option 2.
#include <iostream>
int main() {
bool enchantedRules = true;
if(enchantedRules) {
std::cout << "Enchanted rules!";
}
else {
std::cout << "Enchanted does not rule!";
}
for(;;) std::cin.get();
return 0;
}
Wrycu
10-27-2008, 02:10 PM
You forgot
if (condition) { stuff(); }
I wasn't aware of it, but I didn't forget it! See the "other" choice in the poll?
Edit:
This thread is not stupid. It's got a purpose, and it's informative. Please keep your negative thoughts to yourself, or the flaming section.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.