From bd0fc7054dd2fc048f9cefa962f521f54720c37d Mon Sep 17 00:00:00 2001 From: ergz Date: Wed, 16 Aug 2023 23:22:36 -0700 Subject: [PATCH] gonna try doing the c stuff in odin --- odin/main.odin | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 odin/main.odin diff --git a/odin/main.odin b/odin/main.odin new file mode 100644 index 0000000..a71ac09 --- /dev/null +++ b/odin/main.odin @@ -0,0 +1,20 @@ +package main + +import "core:fmt" + +linear_search :: proc(arr: []int, len: int, needle: int) -> bool { + for index, val in arr { + if val == needle { + return true; + } + } + return false; +} + +main :: proc() { + fmt.println("hello there here is a for loop"); + + values: []int = {1, 2, 3, 4, 5}; + res: bool = linear_search(values, 5, 2); + fmt.println(res); +}