-
-
Save joseoliv/f793e0b41389875746eff5a357fdcda1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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