So I'm making a code that's basically Hangman where the user has to guess the letters in a word that's already been decided. I did that by making each word into a vector.
The if/else statement shown below is where, if the letter the user enters matches a letter in the word, it prints "correct" but if it doesn't, it prints "incorrect". My issue is that even if the user's guess matches one of the letter, (and it prints "correct"), it also prints incorrect for every other letter.
if guess==word(k) disp ( 'Correct!' ) disp ( 'Incorrect' ) I tried writing it as two seperate if statements but that didn't change anything. if guess==word(k) disp ( 'Correct!' ) if all(guess~=word(k)) disp ( 'Incorrect' )I also tried the two if statemnts with break at the end of each but that jsut made it print incorrect every time.
Anyone have any idea how to fix this? I'd really appreciate it!I've added my code as a whole so you can see what I'm trying to do, in case that makes things clearer: