Algorithms/Find maximum/visual basic method 3

< Algorithms < Find maximum
Public Function Pear(ByVal Nums() as Integer) as Integer
Dim AryStart as Integer = 0
Dim AryEnd as Integer = Nums.Length - 1

If AryEnd - AryStart = 1 Then
→If Nums(AryEnd) > Nums(AryStart)
→→Return Nums(AryEnd)
→Else
→→Return Nums(AryStart)
→End if
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.