Skip to content

The difference between ' and " in Neil

Jeroen Broks edited this page Aug 14, 2020 · 2 revisions

They should NOT be used without thinking. Neil makes a difference between " and ', and even it even counts pretty harsh....

Perhaps this screenshot from my PowerShell window in which I used Kitty to show the code and QuickNeil to run the code will show you why: image

Yup, when using single quotes, Neil will return the character values, this is based on how C handles the difference between "" and ''. Of course, C will only take one character from it, Neil can produce an entire string and return them all the same. This makes character chains not really usable for if routines and while loops. Although I could think of one nasty trick in a For-loop, although I do consider this dirty code:

Dirty code!

But that is only for people who KNOW what they are doing 😜😁

Notes:

  • Escape keys have no value in a char chain, although if you need the character ' itself you should prefix it with a backslash as well as the backslash itself. \n will return the character value of the letter 'n' and not 0x0a for the new line.
  • It is however possible future versions WILL support this, so don't use backslashes when you don't have to.