Logical Operator Problem 
Author Message
 Logical Operator Problem

Quote:

> I can't get the logical operator to work logically.
> Can anyone help?

> write('Serviceman_Age      : ');
> Readln (result[counter].Serviceman_Age);

  with result[counter] do

Quote:
>   if (serviceman_age >=16) and (serviceman_age <25) then
> begin

You fill the age in one variable, but then ask another variable.
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria ++43-7219-7035
Muehlviertler Elektronik Glaser. Industrial control and instrumentation
-----------------------------------------------------------------------

http://www.*-*-*.com/ ~franzglaser   http://www.*-*-*.com/


Wed, 18 Jun 1902 08:00:00 GMT  
 Logical Operator Problem

comp.lang.Pascal.borland:

Quote:
>Readln (result[counter].Serviceman_Age);
>if (serviceman_age >=16) and (serviceman_age <25) then
>If I use the statement in line 3,
>any age that I enter will still be under cat X

Firstly, when you step through this program in the IDE, put the
variables;

serviceman_age and result[counter]serviceman_age

into the watch window.

(Hint: Look at the variable you're inputting, and the variable you're
trying to reference).

Quote:
>but if i replace line 3 with readln(serviceman_age);
>it works just fine.

Does the line;

serviceman_age := result[counter].serviceman_age

ring any bells? When you input to one variable, you *CAN* then store
the inputted value to a second (third, fourth, etc..) variable.

As a side note - it's good coding practises to read input with strings,
so that you may parse it to make sure there are no typo's (foreign
characters) contained within. For instance, if I were to enter 18, then
hit the apostrophe (') key on my way to the enter key, the input would
be invalid and return 0.

--

= Stewart Honsberger (AKA Blackdeath)
= Web: http://www.*-*-*.com/ : 3484915
= Remove 'thir{*filter*}' to reply privately

... I hit my CRTL key but i'm STILL not in control....
-!- GOPGP/2 v1.21



Wed, 18 Jun 1902 08:00:00 GMT  
 Logical Operator Problem


Quote:

>> I can't get the logical operator to work logically.
>> Can anyone help?

>> write('Serviceman_Age      : ');
>> Readln (result[counter].Serviceman_Age);
>  with result[counter] do
>>   if (serviceman_age >=16) and (serviceman_age <25) then
>> begin

>You fill the age in one variable, but then ask another variable.

I just wonder how he managed to have a variable and a field with same
name. Doing so is asking disaster. Maybe he had a compile time error and
"fixed" it by adding the variable definition.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Logical Operator Problem

2. logical operators in pascal, help!

3. TQuery calculated field and logical operator

4. Local SQL, problem with OR operator in WHERE clause

5. Problem using LIKE operator with DBASE files in Delphi

6. Accessing logical fields in paradox tables via ODBC

7. Delphi2-Logical Field True<=>Yes,False<=>No Display

8. Tip: Indexing & Searching With dBASE Logical Fields

9. Creating an logical combination brute-forcing routine ??

10. logical and

11. Reset logical connection NW4.1

12. calculating logical fields with sql?

 

 
Powered by phpBB® Forum Software