about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhanemile <hanemile@chaosdorf.de>2018-09-28 18:16:31 +0200
committerhanemile <hanemile@chaosdorf.de>2018-09-28 18:16:31 +0200
commit13a6375482f38353a3dcf2fc9f1be00a789ce9c8 (patch)
treeebda2fcc87f8426a383a88985287e357eb62a490
parent9563a5ff02bd5d4415bf18158a952bfbc02dfc5c (diff)
print_arr prints a given slice
-rw-r--r--print.go19
1 files changed, 19 insertions, 0 deletions
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("---")
+}