comparison website/src/manual.html @ 1384:f5368cd8c056

remove template expressions and String.concat
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 15 Aug 2019 14:33:35 -0600
parents 372906d1d08b
children eb8b35dccd99
comparison
equal deleted inserted replaced
1383:a3d0d1c2ce89 1384:f5368cd8c056
68 <li><a href="#length">The Length Operator</a></li> 68 <li><a href="#length">The Length Operator</a></li>
69 <li><a href="#precedence">Precedence</a></li> 69 <li><a href="#precedence">Precedence</a></li>
70 <li><a href="#constructors">Table Constructors</a></li> 70 <li><a href="#constructors">Table Constructors</a></li>
71 <li><a href="#fn_calls">Function Calls</a></li> 71 <li><a href="#fn_calls">Function Calls</a></li>
72 <li><a href="#fn_def">Function Definitions</a></li> 72 <li><a href="#fn_def">Function Definitions</a></li>
73 <li><a href="#template_expr">Template Expressions</a></li>
74 </ul> 73 </ul>
75 </li> 74 </li>
76 <li><a href="#visibility">Visibility Rules</a></li> 75 <li><a href="#visibility">Visibility Rules</a></li>
77 </ul> 76 </ul>
78 </div> 77 </div>
1084 The visibility rules for local variables are explained in <a href="#visibility">Visibility Rules</a>. 1083 The visibility rules for local variables are explained in <a href="#visibility">Visibility Rules</a>.
1085 1084
1086 1085
1087 <h4 heading><a name="template_stmt" href="#template_stmt">Template Statements</a></h4> 1086 <h4 heading><a name="template_stmt" href="#template_stmt">Template Statements</a></h4>
1088 1087
1089 <p>Template statements are based on <a href="#template_expr">template exressions</a> and provide the full equivalent of <a href="http://en.wikipedia.org/wiki/JavaServer_Pages">JSP</a> but in a general way. Template statements write the equivalent template exression to standard output. For example:</p> 1088 <p>Template statements provide the full equivalent of <a href="http://en.wikipedia.org/wiki/JavaServer_Pages">JSP</a> but in a general way. Template statements write to standard output. For example:</p>
1090 1089
1091 <pre> 1090 <pre>
1092 local name = "Bob" 1091 local name = "Bob"
1093 %> 1092 %>
1094 Hello <%= name %>! 1093 Hello <%= name %>!
1098 1097
1099 <p>is equivalent to the code:</p> 1098 <p>is equivalent to the code:</p>
1100 1099
1101 <pre> 1100 <pre>
1102 local name = "Bob" 1101 local name = "Bob"
1103 require("luan:Io.luan").stdout.write( %> 1102 require("luan:Io.luan").stdout.write( "Hello ", name , "!\nBye ", name , ".\n" )
1104 Hello <%= name %>!
1105 Bye <%= name %>.
1106 <% )
1107 </pre> 1103 </pre>
1108 1104
1109 1105
1110 1106
1111 <h3 heading><a name="expressions" href="#expressions">Expressions</a></h3> 1107 <h3 heading><a name="expressions" href="#expressions">Expressions</a></h3>
1662 If control reaches the end of a function 1658 If control reaches the end of a function
1663 without encountering a <b>return</b> statement, 1659 without encountering a <b>return</b> statement,
1664 then the function returns with no results. 1660 then the function returns with no results.
1665 1661
1666 1662
1667 <h4 heading><a name="template_expr" href="#template_expr">Template Expressions</a></h4>
1668
1669 <p>Luan template expression are based on <a href="http://en.wikipedia.org/wiki/JavaServer_Pages">JSP</a>. Template expressions return multiple values. Here is an example:</p>
1670
1671 <pre>
1672 local name = "Bob"
1673 write( %>Hello <%= name %>!<% )
1674 </pre>
1675
1676 <p>This is equivalent to the code:</p>
1677
1678 <pre>
1679 local name = "Bob"
1680 write( "Hello ", name, "!" )
1681 </pre>
1682
1683 <p>The strings in template expressions may be multiple lines.</p>
1684
1685
1686
1687 <h3 heading><a name="visibility" href="#visibility">Visibility Rules</a></h3> 1663 <h3 heading><a name="visibility" href="#visibility">Visibility Rules</a></h3>
1688 1664
1689 <p> 1665 <p>
1690 Luan is a lexically scoped language. 1666 Luan is a lexically scoped language.
1691 The scope of a local variable begins at the first statement after 1667 The scope of a local variable begins at the first statement after
2276 <p> 2252 <p>
2277 Receives zero or more integers. 2253 Receives zero or more integers.
2278 Returns a string with length equal to the number of arguments, 2254 Returns a string with length equal to the number of arguments,
2279 in which each character has the internal numerical code equal 2255 in which each character has the internal numerical code equal
2280 to its corresponding argument. 2256 to its corresponding argument.
2281
2282
2283 <h4 heading><a name="String.concat" href="#String.concat"><code>String.concat (&middot;&middot;&middot;)</code></a></h4>
2284
2285 <p>
2286 Concatenates the <a href="#Luan.to_string"><code>to_string</code></a> value of all arguments.
2287
2288 2257
2289 2258
2290 <h4 heading><a name="String.encode" href="#String.encode"><code>String.encode (s)</code></a></h4> 2259 <h4 heading><a name="String.encode" href="#String.encode"><code>String.encode (s)</code></a></h4>
2291 2260
2292 <p> 2261 <p>