Which one? (1, 2, or 3)

Which one? (1, 2, or 3)

Attached: dosomething.jpg (520x1078, 46.83K)

(cond (...? ...)
(...? ...)
(else ...))

2.

This

In your toy example it looks retarded in every way, but I get what you mean and the answer is definitely 2. You want a return statement in the main function block to explicitly tell what the function does in the main/default scenario, then you want a return inside an if block to tell what it does in that specific edge case.
For example, the major thing about fibonacci is that it computes f(n-1) + f(n-2). You want to write this thing in the main function block because that's what this function is all about. Then, there is the edge case for f(0) and f(1) which should be relegated inside an if block.
unsigned long fibonacci(unsigned int n) {
if (n < 1) return 1;
return fibonacci(n-1) + fibonacci(n-2);
}


With an explicit return at the end of the function you are making the default behavior clear. So 1 is less explicit and 3 is even worse as it makes everything more ambiguous.

Lmao ))

Anyone who says 2 over 1 is a code monkey mathlet. It demonstrates software "engineer" design pattern thinking instead of logic.

1 is verbose reduntant pajeetware
this, except don't use tree recursion for fibonacci desu

Tell me how I know never took a single uni level math course above precalc.

>you should write retarded if statements because of muh math
lol
lmao
get outta here rajesh

>don't use tree recursion for fibonacci
Yeah, no shit. Feel free to write your own extremely short example that somehow makes sense.

All of them in the same document at random

any dev worth anything will tell you 2
and it is 2

My dude, you learn memoization in your standard computer science courses.

>bracket colorization enabled
ngmi

Same. Fuck spending time on things that don't matter

3 because it's easier to debug

>she writes bugs
>so many that she writes worse if statements to cope
ngmi

I hated it at first too but grew to like it
It's just helpful feedback

switch (stuff)
{
case true:
{
// work
}
default:
{
// other work
}
}

Put if/else in the bin where it belongs.

eww