Re: If/then and sequences...
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Aug 29, 2000
- 460 views
Lewis, I forgot that any NON-ZERO value will be interpreted as TRUE . That does make it easier, thanks. And your: > i = find (x, s) > if i then > do_something (s[i]) > end if looks like it should be an answer in a EuFAQ. Dan ----- Original Message ----- From: "Lewis Townsend" <keroltarr at HOTMAIL.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Tuesday, August 29, 2000 5:25 PM Subject: Re: If/then and sequences... > 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.