# Board index » delphi » "If" help

## "If" help

Please tell me how a If statment between two numbers looks like.
Example:
If number is between 3 and 10 then

?berg
http://home1.swipnet.se/~w-10958
--

\\\|///
\\  - -  //
(  @ @  )
+-------------------------------oOOo-(_)-oOOo-------------+

Being weird is not enough

So be it!

+---------------------------------------Oooo--------------+
oooO   (   )
(   )    ) /
\ (    (_/
\_)

## Re:"If" help

##### Quote
Daniel ?berg <lennart.ob...@mailbox.swipnet.se> wrote:
>Please tell me how a If statment between two numbers looks like.
>Example:
>If number is between 3 and 10 then
>?berg
>http://home1.swipnet.se/~w-10958

If you wish to exclude 3 and 10 use:

If (num > 3) and (num < 10) then

If you wish to include both:

If (num >= 3) and (num <= 10) then

Regards,
Clif    <clifp...@airmail.net>

## Re:"If" help

##### Quote
>If number is between 3 and 10 then

IF (Nr > 3) AND (Nr < 10) THEN

or

IF (Nr >= 3) AND (Nr <= 10) THEN

depending on what you mean with 'between'....

peter de jong
wpdej...@worldonline.nl

## Re:"If" help

Daniel ?berg <lennart.ob...@mailbox.swipnet.se> skrev i artiklen
<32FD0943.3...@mailbox.swipnet.se>...

##### Quote
> Please tell me how a If statment between two numbers looks like.
> Example:
> If number is between 3 and 10 then

Hello.

IF ( 3 <= A) AND (A <= 10) THEN

Regards
F Agnbro
agn...@post5.tele.dk
Stud. Computer Scientist.

## Re:"If" help

IF (num >= 3) AND (num <= 10) THEN

##### Quote
> Please tell me how a If statment between two numbers looks like.
> Example:
> If number is between 3 and 10 then

## Re:"If" help

##### Quote
> > Please tell me how a If statment between two numbers looks like.
> > Example:
> > If number is between 3 and 10 then

> IF ( 3 <= A) AND (A <= 10) THEN

Not quite.  He wants to test if the value is _between_ the 2 numbers
(meaning 4-9).  The If statement would have to be:

if (A > 3) and (A < 10) then...

## Re:"If" help

##### Quote
> >If number is between 3 and 10 then

> IF (Nr > 3) AND (Nr < 10) THEN

> or

> IF (Nr >= 3) AND (Nr <= 10) THEN

> depending on what you mean with 'between'....

Certainly there's a symantic issue here, and my interpretation is
different from yours - "between" means within but not including, as
"beteeen two trees".  Therefore, I take the requirement to test for the
values 4 through 9, and _not_ include 3 and 10.
The problem definition is vague, to be sure...

## Re:"If" help

##### Quote
Mike Copeland wrote:

> > > Please tell me how a If statment between two numbers looks like.
> > > Example:
> > > If number is between 3 and 10 then

> > IF ( 3 <= A) AND (A <= 10) THEN

>    Not quite.  He wants to test if the value is _between_ the 2 numbers
> (meaning 4-9).  The If statement would have to be:

>   if (A > 3) and (A < 10) then...

If A is an integer, you can see if A is in the specified set of integers
in a slightly more compact way, e.g.,

if   A in [3..10]
then ...

Obviously, the requirement specification needs to say if this is an
"inclusive" [3..10] or "exclusive" [4..9] case.

efg

--
Earl F. Glynn          EarlGl...@WorldNet.att.net
EFG Software              913/859-9557  Voice/Fax
Scientific/Engineering/Medical Applications
Overland Park, KS  USA

## Re:"If" help

In article <32FEA1EF.6...@postoffice.worldnet.att.net> of Sun, 9 Feb
1997 22:19:59 in comp.lang.pascal.borland, "Earl F. Glynn" <EarlGlynn@po

##### Quote
stoffice.worldnet.att.net> wrote:

>If A is an integer, you can see if A is in the specified set of integers
>in a slightly more compact way, e.g.,

>   if   A in [3..10]
>   then ...

TP7 help :
The base type of a set must be an ordinal type with
no more than 256 possible values.

The ordinal values of the upper and lower bounds of
the base type must be between 0 and 255.
(*inclusive* jrs)

Variable A can indeed be an integer, but if it does not lie in 0..255,
there will in {\$R+} be a rangecheck error and otherwise its Hi byte will
AFAICS & AFAIR be ignored.  It should be a byte.

To the right of "in" can be as complex as you like, provided that it is
a legitimate set expression of type "set of byte" or subset thereof.

--
John Stockton, Surrey, UK.  j...@merlyn.demon.co.uk  Turnpike v1.12  MIME
Web URL: http://www.merlyn.demon.co.uk/
Standard signature separator is as above, a line containing "-- " (SoRFC1036)
Standard quoter : ">" / "> " , recognised by good news readers