Created
May 20, 2021 10:34
-
-
Save cuongld2/b54052c8b35077848b3bed776ead003c to your computer and use it in GitHub Desktop.
Find maxium number in a list - julia
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
function find_maximum(array) | |
global maximum | |
if length(array)==0 | |
return maximum | |
end | |
if maximum<last(array) | |
maximum=last(array) | |
end | |
println(array) | |
println(last(array)) | |
pop!(array) | |
return find_maximum(array) | |
end | |
println(find_maximum([1,8,2,3,9,4,6,7])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment