summaryrefslogtreecommitdiffstats
path: root/tests/syntax-tests/highlighted/Julia/test.jl
blob: 0750fd65229eb4e204f0da9709a83d08752df4e4 (plain)
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
69
70
71
x = 3

y = 2x

typeof(y)

f(x) = 2 + x


f

f(10)


function g(x, y)
    z = x + y
    return z^2
end

g(1, 2)

let s = 0
    for i in 1:10
        s += i    # Equivalent to s = s + i
    end
    s
end


typeof(1:10)

function mysum(n)
    s = 0
    for i in 1:n
        s += i
    end
    return s
end

mysum(100)

a = 3

a < 5

if a < 5
    "small"[