@wallhackio not an undergrad but purrsonally i just despise how if-elseif chains look
@aescling but switch statements add a bunch of indentation so for me it's picking your poison
@wallhackio @aescling Do they?
switch (some_enum) {
case VALUE1:
do_something();
break;
case VALUE2:
do_something_else();
break;
}
vs.
if (some-enum == VALUE1) {
do_something();
} else if (some_enum == VALUE2) {
do_something_else();
}
That's the same amount of indentation...
@vaporeon_ @aescling oh I have a skill issue it seems
@vaporeon_ @aescling I would always do it like
switch(gorp) {
case 'norp':
console.log('norp');
break;
case 'sorp':
console.log('sorp');
break;
default:
console.log(' what the gorp???');
break;
}
@wallhackio @aescling Cursed
Will not work in C
@vaporeon_ @aescling this is JavaScript
@wallhackio @aescling You can switch statement on a string in JavaScripts? Even though gorp and 'norp' don't point to the same address? ![]()
@wallhackio @vaporeon_ the equality check on strings in most languages with a string type is an implicit strcmp, yeah. python does this