Re: Euphoria ASCII function revisited

new topic     » goto parent     » topic index » view thread      » older message » newer message

-- You can include wildcard.e, and convert the inputs to lower case,
-- Which will shorten the elsif section.  This code will loop until
-- you press q to quit.

include wildcard.e
integer key

while 1 do
key = 0

  while find(key, "YyNnQq") = 0 do -- loop until Y, y, N, n, Q, or q is
pressed
    key = get_key()
    key = lower(key) -- converts to lower case
  end while

  if key = 'y' then -- y was pressed
    puts(1, "y was pressed\n")
  elsif key = 'n' then
    puts(1, "n was pressed\n")
  elsif key = 'q' then
    puts(1, "\nThank you for using this program.")
    exit
  end if

end while

--Steve Elder

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu