literals
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
literals [2018/02/10 08:14] – created wolfgangriedmann | literals [2018/08/20 04:05] (current) – wolfgangriedmann | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== String literals ===== | ===== String literals ===== | ||
- | A string literal is delimited with the double | + | A string literal is delimited with the double |
- | < | + | < |
- | Please note that in the VO dialect a string can also be delimited with the single hyphen | + | Please note that in the VO dialect a string can also be delimited with the quotation mark '' |
- | < | + | < |
- | If you need to specify special characters or single | + | If you need to specify special characters or single |
- | < | + | < |
There are also interpolated strings that can contain variables: | There are also interpolated strings that can contain variables: | ||
- | < | + | < |
- | Console.WriteLine( i"Hi {cValue}" | + | Console.WriteLine( i"Hi {cValue}" |
+ | |||
+ | Since in the VO dialect a string can also be defined with single quotation marks, there is no possibility for the compiler to see a difference between a single character string and a char. Therefore you should prefix a char literal with a '' | ||
+ | <code visualfoxpro> | ||
For more details please see [[strings|Strings and their prefixes]] and [[string_char_byte|String, | For more details please see [[strings|Strings and their prefixes]] and [[string_char_byte|String, | ||
Line 17: | Line 20: | ||
===== Numeric literals ===== | ===== Numeric literals ===== | ||
- | As default, every number with decimals is treated as '' | + | As default, every number with decimals is treated as '' |
If you need to specify what type a numeric literal should take, use suffixes: | If you need to specify what type a numeric literal should take, use suffixes: | ||
* '' | * '' | ||
- | * '' | + | * '' |
* '' | * '' | ||
* '' | * '' | ||
You can also use a prefix of '' | You can also use a prefix of '' | ||
Sample code: | Sample code: | ||
- | < | + | < |
- | Console.WriteLine( " | + | Console.WriteLine( " |
- | Console.WriteLine( " | + | Console.WriteLine( " |
- | Console.WriteLine( " | + | Console.WriteLine( " |
- | Console.WriteLine( " | + | Console.WriteLine( " |
- | Console.WriteLine( " | + | Console.WriteLine( " |
- | Console.WriteLine( " | + | Console.WriteLine( " |
+ | Console.WriteLine( " | ||
+ | |||
+ | For explanations why these suffixes differ from these on C#, please see this X# forum post: [[https:// | ||
literals.1518250464.txt.gz · Last modified: 2018/02/10 08:14 by wolfgangriedmann