Nix (language): Difference between revisions
imported>Makefu No edit summary |
imported>Makefu →let ... in statement: init |
||
| Line 138: | Line 138: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
==== <code>let ... in</code> statement ==== | ==== <code>let ... in</code> statement ==== | ||
With <code>let</code> you can define local variables which can also reference to self without the need of the <code>rec</code> construct. This feature is use inside expressions to prepare variables which become part of an output. | |||
The usage of <code>let</code> is comparable to the [http://zvon.org/other/haskell/Outputsyntax/letQexpressions_reference.html Haskell let expression] | |||
<syntaxHighlight lang=nix> | |||
let | |||
a = 1; | |||
b = 2; | |||
in a + b | |||
=> 3 | |||
</syntaxHighlight> | |||
==== <code>inherit</code> statement ==== | ==== <code>inherit</code> statement ==== | ||
TODO | TODO | ||