Forum > Beginners

Error in a nested if condition

(1/1)

py2pa:
For the following piece of code:


--- Code: ---if join_first_prop then
   if syllables.Count > 1 and length(syllables[0]) = 1 then
      bla...bla...bla
--- End code ---

where:
* join_first_prop is a boolean and
* syllables is a TStringList

the compiler highlights Count and throws the error: Incompatible types: got "Boolean" expected "LongInt". Please help.

typo:

--- Code: ---  if (syllables.Count > 1) and (length(syllables[0]) = 1) then

--- End code ---

taazz:
you forgot your parenthesis the error message says it clearly "if" requires boolean expressions can't handle other types. ee

--- Code: ---if join_first_prop then
   if (syllables.Count > 1) and (length(syllables[0]) = 1) then
      bla...bla...bla

--- End code ---

py2pa:
Thank you so much.

Navigation

[0] Message Index

Go to full version