home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!elroy.jpl.nasa.gov!nntp-server.caltech.edu!draco.macsch.com!convex.is.macsch.com!dnl
- From: dnl@convex.is.macsch.com (David Lombard)
- Subject: Re: How does one return a logical value...???
- Message-ID: <1992Nov19.161634.9841@draco.macsch.com>
- Sender: usenet@draco.macsch.com (Usenet Poster)
- Organization: MacNeal-Schwendler Corp.
- References: <BxwrJC.GME@cs.uiuc.edu>
- Date: Thu, 19 Nov 92 16:16:34 GMT
- Lines: 49
-
- 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. . What
- >should I use I tried T instead of .TRUE. . It doesn't give errors
- >but it doesn't increment the uncontrol... it never goes into the
- >IF statement; skips it completely. I'm new to FORTRAN and please
- >if anyone knows what I should do, let me know via e-mail. Thanks
- >in advance to all that reply to my e-mail.
- >
-
- I *assume* you have the declaration:
-
- logical CheckActivity
-
- In such case, the result of the function is already a TRUE/FALSE value.
-
- _You_do_not_compare_logicals_to_.TRUE._or_.FALSE._!!!!!!!!!!!!
-
- You should just write:
-
- IF( CheckActivity( previous, ROWS, COLS ) ) THEN
-
- Also, never, ever, write
-
- logvar = .FALSE.
- if( _some_logical_expression_ ) logvar = .TRUE.
-
- Instead write
-
- logvar = _some_logical_expression_
-
- Say What You Mean!
-
-
- Regards,
- DNL
-
- MY_COMMENTS = MY_OPINIONS = NOBODY_ELSES;
-
- David N. Lombard The first thing we do, The MacNeal-Schwendler Corp
- dnl@macsch.com Let's kill all the lawyers. 815 Colorado Blvd
- (213) 259-4911 II Henry VI, IV.ii Los Angeles, CA 90041
-