Name: Anonymous 2010-02-28 18:55
/prog/, I want to know what is more more accepted method of two different
So, method one:
Method two:
Method three:
if statements sharing an identical routine. I'm not good at explaining, so I think you'll work out what I mean by the following examples:So, method one:
void func_main(){
int i = 0;
if (...bool1...){
i = 1;
}
else if (...bool2...){
i = 2;
}
else {
return;
}
...functions...
}Method two:
void func_sub(){
...functions...
}
void func_main(){
int i = 0;
if (...bool1...){
i = 1;
func_sub();
}
else if (...bool2...){
i = 2;
func_sub();
}
}Method three:
void func_main(){
int i = 0;
if (...bool1... || ...bool2...){
if (...bool1...){
i = 1;
}
else if (...bool2...){
i = 2;
}
...functions...
}
}