That's happening because you're checking if the value returned by the function "equal" is not -1. It will always be true since "equal" returns true (1) or false (0). To fix that just switch
!= -1 for
!= 0
For more info on "equal" function
check this
__________________