Skip to content

Commit

Permalink
demo: _tinygo
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Jul 10, 2024
1 parent 0e18a0b commit 05b5c37
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo/_llgo/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module llgoexample

go 1.21 // llgo 1.0
go 1.18 // llgo 1.0

require github.com/goplus/llgo v0.9.0
3 changes: 3 additions & 0 deletions demo/_tinygo/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module tinygoexample

go 1.18 // tinygo 0.32
19 changes: 19 additions & 0 deletions demo/_tinygo/sortdemo/sort.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import "sort"

vals := [32, 58, 25, 92, 45, 78]
sort.ints vals
for v <- vals {
println v
}

texts := ["apple", "banana", "cherry", "date", "elderberry", "fig"]
sort.slice texts, (i, j) => {
leni, lenj := len(texts[i]), len(texts[j])
if leni != lenj {
return leni < lenj
}
return texts[i] < texts[j]
}
for v <- texts {
println v
}

0 comments on commit 05b5c37

Please sign in to comment.