Hey guys.
I have the following loop structure condition statement:

while ( ord(UpperCaseWords[i]) >= ord('A') and ord(UpperCaseWords[i]) <= ord('Z')) do

Problem: When a compile, I get an error saying: "Error: Incompatible types: got "BOOLEAN" expected "LONGINT" "
using Dev-Pascal 1.9.2.

UpperCaseWords = PACKED ARRAY of Characters that may contain any symbol, blank space, or 'A' to 'Z'.

What I am attempting to do is determine if the ordinal value (ASCII value) falls in a range defined by the upper case ordinal value of 'A' and 'Z'. If it is, I want to enter into the loop and do some things.

I am really trying to code the c++ code into pascal
while( int(word[j]) >= 65 && int(word[j]) <= 90 ) where 65 is the ASCII value of 'A' and 90 is the ASCII value of 'Z'
Can anyone please help me?
Thanks for any help.

Edited by alex910TN: better understanding of my question

5 Years
Discussion Span
Last Post by pritaeas

Have you tried this:

while (ord(UpperCaseWords[i]) >= ord('A')) and (ord(UpperCaseWords[i]) <= ord('Z')) do
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.