Mercurial Hosting > luan
diff website/src/diff.html.luan @ 1812:f44dcb3fedf7
docs - add code block
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 10 Jun 2024 14:41:48 -0600 |
parents | ba43135bb98d |
children | fa0e73119b7c |
line wrap: on
line diff
--- a/website/src/diff.html.luan Wed May 15 18:02:28 2024 -0600 +++ b/website/src/diff.html.luan Mon Jun 10 14:41:48 2024 -0600 @@ -138,28 +138,28 @@ %> <p>Luan has no numeric <b>for</b> statement. Luan only has generic <b>for</b> statement. Instead of the numeric <b>for</b> statement, Luan uses the <code>range</code> function in a generic <b>for</b> statement like this:</p> -<pre> - for i in range(from,to,step) do <em>block</em> end -</pre> +<code block> +for i in range(from,to,step) do <em>block</em> end +</code> <p>The Luan generic <b>for</b> statement is simpler than the Lua version because Luan only uses an expression, not an explist. So a <b>for</b> statement like:</p> -<pre> - for var_1, ···, var_n in exp do block end -</pre> +<code block> +for var_1, ···, var_n in exp do block end +</code> <p>is equivalent to the code:</p> -<pre> - do - local f = exp - while true do - local var_1, ···, var_n = f() - if var_1 == nil then break end - block - end +<code block> +do + local f = exp + while true do + local var_1, ···, var_n = f() + if var_1 == nil then break end + block end -</pre> +end +</code> <% end } @@ -177,9 +177,9 @@ %> <p>Unlike Lua, Luan allows <b>or</b> and <b>and</b> expressions to be stand-alone statements. This is useful in cases like this:</p> -<pre> - x==5 or error "x should be 5" -</pre> +<code block> +x==5 or error "x should be 5" +</code> <% end }