Module Search
Public Function LinearSearch(array as Integer(), number as Integer) As Integer
For index As Integer = 0 To array.Length - 1
If array(index) = number Then
Return index
End If
Next
Return -1
End Function
Sub Main()
Dim array as Integer() = {4, 8, 1, 3, 8, 0, 2, 5, 2}
Dim number as Integer = 0
Dim index as Integer = LinearSearch(array, number)
If index = -1 Then
Console.WriteLine("Liczby nie ma w tablicy")
Else
Console.WriteLine("Liczba jest w tablicy pod indeksem {0}", index)
End If
End Sub
End Module