% Play the number guessing game

% David Kauchak
% 11/29/11

guess = -1;

% pick a random number
num = randi(10);

% keep looping until the user guesses right
while guess ~= num
    guess = [];
    
    while isempty(guess)
        guess = input('Guess a number (1-10): ');
    end
     
    if guess > num
        disp('A bit too high...')
    elseif guess < num
        disp('A bit too low...')
    else
        disp('Got it!')
    end
end