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

I like the use of language in perl and wish it was more prevalent in other languages.

For example instead of saying "if not <condition>" you can also say "unless <condition>" which is more natural imo.



Yes it's a weird feature but I found myself drawn to it. Just like with natural language, sometimes the 'unless' keyword feels like a better fit.

Both keywords work in postfix form, and this is how I usually use 'unless' so it reads more like a sentence.

  do_thing() unless ($a == 1);
  do_thing() if ($a != 1);


This is valid in crystal:

    unless a
        a = 4
    end
    return x unless y
    return z




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

Search: