From 13a6375482f38353a3dcf2fc9f1be00a789ce9c8 Mon Sep 17 00:00:00 2001 From: hanemile Date: Fri, 28 Sep 2018 18:16:31 +0200 Subject: print_arr prints a given slice --- print.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 print.go diff --git a/print.go b/print.go new file mode 100644 index 0000000..c24917d --- /dev/null +++ b/print.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + "log" +) + +// print_arr prints all the items in the given array +func print_arr(arr []star) { + + log.Printf("[+] Printing array") + + // Iterate over all the elements in the array and print their content + for _, el := range arr{ + fmt.Printf("%f\t%f\t|%f\t%f\t|%f\n", el.c.x, el.c.y, el.f.x, el.f.y, el.mass) + } + + fmt.Println("---") +} -- cgit 1.4.1