From 10bc00ef89711135363dda2f522c1830af673e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C3=B3=C5=82grabia?= Date: Fri, 22 Jul 2022 13:21:21 +0200 Subject: [PATCH] Adding control blocks examples. --- control_blocks/main.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 control_blocks/main.go diff --git a/control_blocks/main.go b/control_blocks/main.go new file mode 100644 index 0000000..34d39ce --- /dev/null +++ b/control_blocks/main.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + "math" +) + +func pow(x, n, lim float64) float64 { + if v := math.Pow(x, n); v < lim { + return v + } else { + return lim + } +} + +func main() { + fmt.Println( + pow(3, 2, 10), + pow(3, 3, 20), + ) +}