E2066 Missing operator or semicolon error for NO reason

I have the following line of code.   If it is in my app, it will fail with the message: E2066 Missing operator or semicolon.  If the line is NOT there, it will compile fine.

Artist is a valid public string to the unit.  

if Length(artist) = 0 then artist := 'Unknown';


Why the heck is this happening?
LVL 1
hibbidijiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

moorhouselondonCommented:
Without seeing a bigger excerpt of the code, it is difficult to advise.  On the face of it, there is no reason for it to fail.  Things to look at:

Is artist or length being used in a different context to normal?  e.g. using artist as the unit name; using length as a variable, using either of these in a Const declaration.  Look for Includes in your code.

What happens if you override the artist declaration by defining it within the function/procedure where this error is occurring?  (I know this will prevent the program from working correctly, but may give a clue where the problem is).
0
Mohammed NasmanSoftware DeveloperCommented:
are you sure there's a semicolon before the line you wrote above?

if you show few lines from your code, it will be easier to analyze your problem
0
tobjectpascalCommented:
I agree, more than likely the problem is with the line above, what's the chances you have a nested if statement / case statment just above?
0
Scay7Commented:
if Length(artist) = 0 then artist := 'Unknown';

Try

a : length(artist); //assign as integer (a)
if a = 0 then artist := 'unknown';

But ye it should work without doing this...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.