Re: If/then and sequences...

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

Hello Dan,

>     if find(1,KeyPressed) then -- pressed <esc> key ("1")

I do this all the time.

>'course, now that I've said that, I've just realized (from reading the
>manual!), that that only works if the FIRST item in the sequence is the
>match (because it returns the *position* of the match, which is taken as
>"true" by the "if" when it is the first position), so I have to go back &
>fix that!

Any NON-ZERO value will be interpreted as TRUE so it still
works. 0 is false (it didn't "find" it) and anything else
is true and it tells you where.

I do this quite often:

i = find (x, s)
if i then
  do_something (s[i])
end if

>But it's potentially useful anyway.

absolutely.

later,
Lewis Townsend
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu