RE: if statement not working

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

equal() us just a derivitive of compare()

function equal(object a, object b)
   return not compare(a,b)
end function

every relational operator can be mapped directly to compare().
a =b  : compare(a,b)  =0
a!=b  : compare(a,b) !=0
a <b  : compare(a,b)  <0
a>=b  : compare(a,b) >=0

etc...

refer specifically to Derek Parnell's post "Re:[If/then and 
sequences...]"

Chris

Kat wrote:
> On 22 Mar 2002, at 4:10, bensler at mail.com wrote:
> 
> > 
> > Refer to the "[If/then and sequences...]" thread from Aug 2000
> > or the "Comparing Sequences" thread from Oct 2000
> 
> How about it, Karl, a fall-thru the "=" to the equal()?
> 
> Kat
> 
> > Chris
> > 
> > Derek Parnell wrote:
> > > 
> > > This, in my not so humble opinion, is one of RDS's lesser decisions.
> > > 
> > > For some reason, not quiet explained yet, RDS decided that sequences 
> > > must not allowed to be compared 
> > > using the normal comparision operators. For sequences you are forced 
> > > into calling a function to 
> > > compare them. The two main functions are 'compare()' and 'equal()'.
> > > 
> > >   compare(s1,s2) returns one of three values:
> > >     -1  if s1 is less than s2
> > >      0  if s1 equals s2
> > >      1  if s1 is greater than s2
> > > 
> > >   equal(s1,s2) returns one of two values:
> > >      0 if s1 is not equal to s2
> > >      1 if s1 is equal to s2
> > > 
> > > Go figure! Many people have been try to get RDS to see sense in using 
> > > the standard comparision 
> > > operators with sequences but to no avail yet.
> > > 
> > > -------
> > > Derek.
> > > 
> > > 22/03/2002 11:04:33 AM, xxmyt at yahoo.com wrote:
> > > 
> > > >
> > > >hello everyone. 
> > > >
> > > >the code i pasted down works properly. however, it doesnt work in the 
> > > >second way.
> > > >
> > > >my code:
> > > >include dos32lib.e
> > > >without warning
> > > >
> > > >constant
> > > >    Win     = create( Window, "PASSWORD REQUIRED", 0, Default, Default, 
> > > >400, 200, 0 ),
> > > >
> > > >    Sle1    = create( EditText, "", Win, 10, 40, 120, 20, 0 ),
> > > >    Button1 = create( PushButton, "OK", Win, 180, 40, 120, 20, 0 )
> > > >
> > > >
> > > >procedure onClick_Button1()
> > > >
> > > >     if  equal(getText(Sle1),"YES") then
> > > >         closeWindow(Win)
> > > >     end if
> > > >
> > > >end procedure
> > > >
> > > >onClick[Button1] = routine_id("onClick_Button1")
> > > >
> > > >WinMain( Win )
> > > >
> > > >  but if i change the if statement this way, i get an error message:
> > > >
> > > >     if  getText(Sle1) = "YES" then
> > > >         closeWindow(Win)
> > > >     end if
> > > >
> > > >error message says, the result of the if statemnt should be an atom. 
> > > >
> > > >so whats it all about?
> > > >
> > > >
> > > ---------
> > > Cheers,
> > > Derek Parnell 
> > > ICQ# 7647806
> > > 
> > >

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

Search



Quick Links

User menu

Not signed in.

Misc Menu