Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Created August 3, 2021 19:34
Show Gist options
  • Save joseoliv/f793e0b41389875746eff5a357fdcda1 to your computer and use it in GitHub Desktop.
Save joseoliv/f793e0b41389875746eff5a357fdcda1 to your computer and use it in GitHub Desktop.
package main
object Program
func run {
Out println: ( self search: [ 3, 9, 7 ], 7 );
Out println: ( self search: [ "cd", "w", "ab" ], "w" );
var Dyn d = 0;
var Int n;
n = (d + 1)*5;
n println
}
func search: array, x -> Int {
var i = 0;
while i < array size {
if array[i] == x {
return i
}
++i
}
return -1
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment