aboutsummaryrefslogtreecommitdiff
path: root/template/go/snip-max-slice.go
diff options
context:
space:
mode:
Diffstat (limited to 'template/go/snip-max-slice.go')
-rw-r--r--template/go/snip-max-slice.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/template/go/snip-max-slice.go b/template/go/snip-max-slice.go
new file mode 100644
index 0000000..4a022ba
--- /dev/null
+++ b/template/go/snip-max-slice.go
@@ -0,0 +1,9 @@
+func max(a []{{_input_:type}}) {{_input_:type}} {
+ m := a[0]
+ for _, v := range a {
+ if v > m {
+ m = v
+ }
+ }
+ return m
+}