Skip to content

Commit

Permalink
Update Julia syntax test
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Jul 13, 2021
1 parent 3da4651 commit 64763ea
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions tests/syntax-tests/highlighted/Julia/test.jl
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
x = 3
x = 3

y = 2x
y = 2x

typeof(y)

f(x) = 2 + x
f(x) = 2 + x


f

f(10)


function g(x, y)
 z = x + y
 return z^2
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
let s = 0
 for i in 1:10
 s += i # Equivalent to s = s + i
 end
 s
 s
end


typeof(1:10)

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

mysum(100)

a = 3
a = 3

a < 5
a < 5

if a < 5
if a < 5
 "small"
else
 "big"
end

v = [1, 2, 3]
v = [1, 2, 3]

typeof(v)

v[2]

v[2] = 10

v2 = [i^2 for i in 1:10]
v2 = [i^2 for i in 1:10]

M = [1 2
M = [1 2
 3 4]

typeof(M)

zeros(5, 5)

zeros(Int, 4, 5)
zeros(Int, 4, 5)

[i + j for i in 1:5, j in 1:6]
[i + j for i in 1:5, j in 1:6]

0 comments on commit 64763ea

Please sign in to comment.