File: prism-go.html

package info (click to toggle)
node-prismjs 1.30.0%2Bdfsg%2B~1.26.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,220 kB
  • sloc: javascript: 27,628; makefile: 9; sh: 7; awk: 4
file content (68 lines) | stat: -rw-r--r-- 957 bytes parent folder | download | duplicates (3)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<h2>Comments</h2>
<pre><code>// This is a comment
/* This is a comment
on multiple lines */</code></pre>

<h2>Numbers</h2>
<pre><code>42
0600
0xBadFace
170141183460469231731687303715884105727
0.
72.40
072.40
2.71828
1.e+0
6.67428e-11
1E6
.25
.12345E+5
0i
011i
0.i
2.71828i
1.e+0i
6.67428e-11i
1E6i
.25i
.12345E+5i</code></pre>

<h2>Runes and strings</h2>
<pre><code>'\t'
'\000'
'\x07'
'\u12e4'
'\U00101234'
`abc`
`multi-line
string`
"Hello, world!"
"multi-line
string"</code></pre>

<h2>Functions</h2>
<pre><code>func(a, b int, z float64) bool { return a*b &lt; int(z) }</code></pre>

<h2>Full example</h2>
<pre><code>package main
import "fmt"

func sum(a []int, c chan int) {
	sum := 0
	for _, v := range a {
		sum += v
	}
	c &lt;- sum // send sum to c
}

func main() {
	a := []int{7, 2, 8, -9, 4, 0}

	c := make(chan int)
	go sum(a[:len(a)/2], c)
	go sum(a[len(a)/2:], c)
	x, y := &lt;-c, &lt;-c // receive from c

	fmt.Println(x, y, x+y)
}
</code></pre>