home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!cs.uoregon.edu!ogicse!flop.ENGR.ORST.EDU!gaia.ucs.orst.edu!umn.edu!noc.msc.net!uc.msc.edu!shamash!ems!ems.cdc.com!mstemper
- From: mstemper@ems.cdc.com (Michael Stemper)
- Newsgroups: comp.lang.fortran
- Subject: Re: How does one return a logical value...???
- Message-ID: <30476@nntp_server.ems.cdc.com>
- Date: 18 Nov 92 19:17:20 GMT
- Article-I.D.: nntp_ser.30476
- References: <BxwrJC.GME@cs.uiuc.edu>
- Sender: sys@ems.ems.cdc.com
- Reply-To: mstemper@ems.cdc.com
- Organization: Empros Systems International, a division of Ceridian
- Lines: 56
- Nntp-Posting-Host: kirk.ems.cdc.com
-
- In article <BxwrJC.GME@cs.uiuc.edu>, ctaylor@cs.uiuc.edu (Conrad W Taylor) writes:
-
- > I have written a function which returns a logical
- >value, CheckActivity(previous, ROWS, COLS), previous is an
- >array. I'm using it like this:
- >
- > IF (CheckActivity(previous, ROWS, COLS) .EQ. .TRUE.) THEN
- > uncontrol = uncontrol + 1
- > ENDIF
- >
- >My compiler says that I have mixed types when I use .TRUE.
-
- Does this module contain a declaration:
-
- LOGICAL CheckActivity
-
- If not, it thinks that CheckActivity is of type REAL, which would
- certainly be mixed types.
-
- One comment on style.
-
- .EQ.
-
- is a logical operator that returns either .TRUE. or .FALSE.
- For instance,
-
- (J .EQ. 3)
-
- Is a logical expression. It has a value of either .TRUE. or .FALSE.
- depending on the value of J.
-
- The IF statement has the form
-
- IF (lexpr) THEN
-
- Where lexpr is a logical expression. Since CheckActivity is a logical
- function (or it will be after you declare it), you can simply say:
-
- IF ( CheckActivity(...) ) THEN
-
- rather than:
-
- IF ( CheckActivity(...) .EQ. .TRUE. ) THEN
-
- This latter usage is leagl but redundant, just like
-
- IF ( (J.EQ.3) .EQ. .TRUE. ) THEN
-
- would be.
-
-
- --
- #include <Standard_Disclaimer.h>
- Michael F. Stemper
- Power Systems Consultant
- mstemper@ems.cdc.com
-