Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    die "Port numbers below 1024 are forbidden"
        if $port < 1024;
is hardly unreadable spaghetti code.


Okay. Now compare:

    die "You may only use port numbers 1024 and higher"
        unless $port >= 1024 || is_root(current_uid());

    die "Port numbers 1024 are forbidden"
        if $port < 1024 && !is_root(current_uid());


My head hurts! Does unless apply to both branches or just one. The if example is easier for sure.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: