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

Here's all the cases for using a semicolon. (estimated 30 seconds read)

1. At the end of local variables

   let
     a = 1;
     b = 2;
    in
    a + b

    result: 3
2. At the end of each attributes in an attribute set (a.k.a. dictionaries or key-value pairs)

    {
      a = 1;
      b = 2;
    }

    result: { a = 1; b = 2; }
3. with expressions

    with pkgs;

    coreutils

    result: (the coreutils attribute in the pkgs attribute set)
4. Assertions

    assert a != null;

    a

    result: (the value of a)

Now, you'll never be confused again.


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

Search: