Wrycu
2008-10-13 16:01:29
Choice 1:
Edit:
And why?
if (condition)
{
//do stuff
}
Choice 2:
if (condition){
//do stuff
}
Edit:
And why?
2008-10-13 16:01:29
if (condition)
{
//do stuff
}
Choice 2:
if (condition){
//do stuff
}
2008-10-13 16:06:37
2008-10-13 16:08:07
2008-10-13 16:08:38
From: Runescapian
Option 1. It's easier to read that way IMO, even if it does take up extra space.
2008-10-13 16:14:32
2008-10-13 18:45:07
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.
2008-10-13 23:35:01
2008-10-14 22:56:47
2008-10-16 09:46:36
2008-10-17 07:04:13
2008-10-17 07:23:27
2008-10-19 10:24:35
if (condition) {
//do stuff
}
2008-10-19 15:30:33
2008-10-19 19:40:54
2008-10-19 19:42:30
if (condition) { stuff(); }
I am all for Allman though :)
2008-10-24 16:10:34
2008-10-27 07:46:58
#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;
}
2008-10-27 10:10:39
From: Hy71194
You forgot
if (condition) { stuff(); }