Recent

Author Topic: var chX : CHAR does not like value '' ?  (Read 2834 times)

Elmug

  • Hero Member
  • *****
  • Posts: 849
var chX : CHAR does not like value '' ?
« on: August 05, 2011, 01:27:41 am »
Dear forum people,

I declared a var of the type Char, named chX, for instance.

In a statement chX := ''   , where '' is nothing in between the two single quotes, I get error message.

But if I only change '' to ' ' (a space between the two single quotes) all compiles and runs fine.

I wonder what is going on that I am missing?

Thanks.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11800
  • Debugger - SynEdit - and more
    • wiki
Re: var chX : CHAR does not like value '' ?
« Reply #1 on: August 05, 2011, 01:49:42 am »
A string can be empty, but a char can not be empty.

You can but a chr(0)   in there, that is still a char.


Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: var chX : CHAR does not like value '' ?
« Reply #2 on: August 05, 2011, 07:37:30 am »
Thanks dear Martin,

I was under the wrong impression that '' (nothing between two quotes) WAS the null character Chr(0), since I use the '' all the time for strings.

An empty pair of quotes means "empty string". What an eye-opener! :o

 

TinyPortal © 2005-2018