Im a beginner at assembly and Im making a program that is going to take the value in a variable num and seeing if that number is in an array, it will print "That number is in the array" if not it will print something else. But it always prints, "The number is not in the array". Why?
section .text
    global _start
    
_start:
    mov eax, [numArray]
    mov ecx, 3 ;How many times Num will loop
    
Num:
    cmp [num], eax ;compare num to eax
    je inArray ;If equal go to inArray message
    dec ecx ;decrement ecx
    inc eax ;move to next element
    jz notIn ;If counter = 0 and a match still has not been found goto notIn
    jnz Num ;Else go back to Num
    
inArray: ;Print msg1
    mov eax, 4
    mov ebx, 1
    mov ecx, msg1
    mov edx, len1
    int 0x80
    
    jmp _exit
    
notIn: ;Print msg2
    mov eax, 4
    mov ebx, 1
    mov ecx, msg2
    mov edx, len2
    int 0x80
    
    jmp _exit
    
_exit: ;exit program
    mov eax, 1
    int 0x80
    
section .data
    num db 1
    numArray db 1, 2, 3
    
    msg1 db 'That is in the array!'
    len1 equ $-msg1
    
    msg2 db 'That is not in the array'
    len2 equ $-msg2
 
    