3 ms·
I think I get it. Writing mostly in C# these days, my instinct when facing nested ifs is to break things down into functions, as you can then return from a func
by n4r9 8y ago
I think I get it. Writing mostly in C# these days, my instinct when facing nested ifs is to break things down into functions, as you can then return from a function call in order to break out of that code block. Admittedly the problem then becomes naming the functions and potentially having to pass a lot of local state around. I guess this is easier to swallow in a class-based language like C# where you can simply wrap the variables into an object or make them fields of the method's class.