Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
dist/
.idea
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,18 @@ sum := func(init, seq) {
return init
}

trunc := func(text; limit=3) {
return len(text) > limit ? text[:limit]+"..." : text
}

fmt.println(sum(0, [1, 2, 3])) // "6"
fmt.println(sum("", [1, 2, 3])) // "123"
fmt.println([
trunc("abcd"),
trunc("abc"),
trunc("ab"),
trunc("abcd", limit=2)
]) // ["abc...", "abc", "ab", "ab..."]
```

> Test this Tengo code in the
Expand Down
Loading