Function to check if user input is between letters

I’m trying to write a function that checks if the user wrote the proper input, if it is, return the input, if its not, asks the user to try again. It looks like this:

function letter_between_AH()

    while false

        t = readline()
        t = uppercase(t)
        t_or_f = all(c-> 0x41 <= Int8(c) <= 0x48,t)

        if t_or_f
            return t
        else
            println("type a valid letter [A:H]")
            return false
        end
    end
end

It doesn’t seem to be working, when I call it, it gives me:

h = letter_between_AH()
print(h)
>> nothing

while false

3 Likes