From c527771bf6f3f53a955d440b90096ccc85e9457c Mon Sep 17 00:00:00 2001 From: sahalsaad Date: Sun, 15 Oct 2017 08:37:35 +0800 Subject: [PATCH] Add Groovy language. --- LinearSearch.groovy | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 LinearSearch.groovy diff --git a/LinearSearch.groovy b/LinearSearch.groovy new file mode 100644 index 0000000..79fdd73 --- /dev/null +++ b/LinearSearch.groovy @@ -0,0 +1,8 @@ +def nums = [1, 2, 3, 8, 9, 12] +def target = 2 + +if (nums.indexOf(target) >= 0) { + println "Successful Search!" +} else { + println "Not in the array." +} \ No newline at end of file