Add more Nim examples (#2265)

* Add more Nim examples

* Newlines :P

* Replace it with openArray

* Remove march, seq

* fix typo
This commit is contained in:
Danil Yarantsev
2020-10-09 00:58:33 +03:00
committed by GitHub
parent d1ddfcf075
commit 62902ddd53
3 changed files with 10 additions and 0 deletions

View File

@@ -89,3 +89,4 @@ From oldest to newest contributor, we would like to thank:
- [Kale Blankenship](https://github.com/vcabbage)
- [George Gribkov](https://github.com/GeorgeGribkov)
- [Artem Akatev](https://github.com/aakatev)
- [Danil Yarantsev](https://github.com/Yardanico)

View File

@@ -0,0 +1,5 @@
# For best results compile with -d:danger
proc maxArray(x: var seq[float], y: seq[float]) {.exportc.} =
for i in 0 ..< x.len:
if y[i] > x[i]:
x[i] = y[i]

View File

@@ -0,0 +1,4 @@
# For best results compile with -d:danger
proc sumArray(data: seq[int]): int {.exportc.} =
for elem in data:
result += elem