KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Check quotations when pasting string literal from external source
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: January 20, 2025

When copying and pasting string literals into the code editor from an external source, such as a text file, double check that the quotation marks used are the proper type for string literals. In 4D, string literals should be enclosed in double quotation marks that are straight, but other double quotations can be slightly different. For example, consider the following code:

var $a; $b : Text

$a:="hello world"
$b:=“hello world”

ALERT(String($a=$b))

The first variable is properly assigned a string literal with straight quotations, while the second variable is mistakenly assigned one that uses different quotation marks. When executed, the comparison expression would alert as “False”, because the second variable fails to be assigned the same string literal as the first. Note that the syntax styling is also different - the first string literal is black and the second one is blue (same as local variables).