From 3c73b82c5f03010fdec32a852ec54e23a52b9eab Mon Sep 17 00:00:00 2001 From: arthurwrls Date: Sun, 30 Oct 2022 08:50:35 +0200 Subject: [PATCH] Function example --- .../Body mass index.xcplaygroundpage/Contents.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Codecademy.playground/Pages/Body mass index.xcplaygroundpage/Contents.swift diff --git a/Codecademy.playground/Pages/Body mass index.xcplaygroundpage/Contents.swift b/Codecademy.playground/Pages/Body mass index.xcplaygroundpage/Contents.swift new file mode 100644 index 0000000..3063f2b --- /dev/null +++ b/Codecademy.playground/Pages/Body mass index.xcplaygroundpage/Contents.swift @@ -0,0 +1,13 @@ +// Simple example of function +// with return statement + +let weight = 70.0 // in Kilograms +let height = 1.73 // in Meters + + +func findBMI() -> Double { +return weight / (height * height) +} + +// Wrap function to print in console +print(findBMI())