Im getting a syntax error and invalid number of indices.2 expected in the following code
indices.2 expected. Invalid Number:
Sub CheckHorizontal(row As Int, col As Int, checkLength As Int, word As String) As Boolean
If col + checkLength > wordSearchGrid(row).Length Then
Return False ' Word goes out of bounds horizontally
End If
For i = 0 To checkLength - 1
If wordSearchGrid(row, col + i) <> word.CharAt(i) Then
Return False ' Mismatch found, word not present horizontally
End If
Next
Return True ' Word found horizontally
End Sub
Sub CheckHorizontal(row As Int, col As Int, checkLength As Int, word As String) As Boolean
For i = 0 To checkLength - 1
Try
If wordSearchGrid(row, col + i) <> word.CharAt(i) Then
Return False ' Mismatch found, word not present horizontally
End If
Catch
Return False ' Word goes out of bounds
End Try
Next
Return True ' Word found horizontally
End Sub