[CODE lang="b4x" title="indices.2 expected. Invalid Number" highlight="2-4"]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[/CODE]