mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
samples: add Terra samples
source: https://github.com/zdevito/terra/tree/master/tests
This commit is contained in:
17
samples/Terra/forbreak.t
Normal file
17
samples/Terra/forbreak.t
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
terra foo(a : int, s : int)
|
||||
var r = 0
|
||||
for i = 0,a,s do
|
||||
if i == 8 then
|
||||
break
|
||||
end
|
||||
r = r + i
|
||||
|
||||
end
|
||||
return r
|
||||
end
|
||||
|
||||
local test = require("test")
|
||||
test.eq(foo(10,1),28)
|
||||
test.eq(foo(10,2),12)
|
||||
test.eq(foo(0,1),0)
|
||||
Reference in New Issue
Block a user