-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtrivial-expr.html
40 lines (35 loc) · 947 Bytes
/
trivial-expr.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<title>Embedding Go expressions</title>
<style>
/*<![CDATA[*/
.answer {
border: thin solid black;
padding: 0.5ex;
color: inherit;
background-color: yellow;
}
blockquote {
width: 10em;
color: black;
background-color: #f0f0f0;
padding: 1ex;
}
/*]]>*/
</style>
</head>
<body>
<p>Perhaps the simplest use of Go Server Pages is to evaluate a Go
expression server-side by placing it within
a <code><?go:expr</code> … <code>?></code>
tag:</p>
<blockquote>
⌊(1 + 2×3 + 4)÷5⌋ =
<span class="answer"><?go:expr (1+2*3+4)/5 ?></span>
</blockquote>
<p>Expressions can have any type on which <code>String()</code> is
defined. This includes all internal data types
(<code>int</code>, <code>string</code>, etc.).</p>
</body>
</html>