Italo Rodrigo
Italo Rodrigo

Reputation: 1785

Comparing strings on delphi get error incompatible types

I have this code:

if (conexao.FieldValues['complex'] = '02' and conexao.FieldValues['financ'] = '04') then

The conexao.FieldValues['complex'] is a string and '02' is a string too, but I get an error:

Incompatible types: 'string' and 'Boolean'

Why?

Upvotes: 1

Views: 826

Answers (1)

Brian
Brian

Reputation: 7289

Order of operations means = is evaluated after and. You need to use () to force the evaluation in the order you intend.

enter image description here

Upvotes: 7

Related Questions