Tip march 10

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

To designate valid values that you might change instead of
coding each value directly to the if statements like

if c = '8' then--use for up
elsif c = '2' then--use for down
elsif c = '4' then--use for left
elsif c = '6' then --use for right
end if

set a sequence with valid values and search them

integer found
sequence s
s = "8246"

found = find(c, s)
--this will also speed the checking by making sure it
--was valid/found first.
if found then
    --found tells where c was found.
  if found = 1 then--use for up
  elsif found = 2 then--use for down
  elsif found = 3 then--use for left
  elsif found = 4 then --use for right
  end if
end if

--Lucius Lamar Hilley III
--  E-mail at luciuslhilleyiii at juno.com
--  I support transfering of files less than 64K.
--  I can Decode both UU and Base64 format.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu