Skip to content

Commit

Permalink
Add "let" and "set for variables
Browse files Browse the repository at this point in the history
Fixes #88.
  • Loading branch information
annevk committed Mar 27, 2017
1 parent 034569b commit f30d4d7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions infra.bs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,28 @@ as well as the single algorithm would. Therefore performance is best left as a f
over.


<h3 id=variables>Variables</h3>

<p>A variable is declared with "let" and changed with "set".

<p class=example id=example-variable>Let |list| be a new <a>list</a>.</p>

<div class=example id=example-variable-null>
<ol>
<li><p>Let |value| be null.

<li><p>If |input| is a <a>string</a>, then set |value| to |input|.

<li><p>Otherwise, set |value| to |input|, <a>UTF-8 decoded</a>.

<li><p>Assert: |value| is a <a>string</a>.
</ol>
</div>

<p>Variables must not be used before they are declared. Variables are
<a href=https://en.wikipedia.org/wiki/Scope_(computer_science)#Block_scope>block scoped</a>.


<h3 id=algorithm-control-flow>Control flow</h3>

<p>The control flow of algorithms is such that a requirement to "return" or "throw" terminates the
Expand Down

0 comments on commit f30d4d7

Please sign in to comment.