literals
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
literals [2018/02/10 14:51] – wolfgangriedmann | literals [2018/08/20 04:05] (current) – wolfgangriedmann | ||
---|---|---|---|
Line 4: | Line 4: | ||
A string literal is delimited with the double quotation mark ''"'' | A string literal is delimited with the double quotation mark ''"'' | ||
- | < | + | < |
Please note that in the VO dialect a string can also be delimited with the quotation mark '' | 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 quotation marks in a string, you need an '' | If you need to specify special characters or single quotation marks in a string, you need an '' | ||
- | < | + | < |
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 20: | Line 23: | ||
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( " | + | Console.WriteLine( " |
For explanations why these suffixes differ from these on C#, please see this X# forum post: [[https:// | For explanations why these suffixes differ from these on C#, please see this X# forum post: [[https:// | ||
literals.1518274301.txt.gz · Last modified: 2018/02/10 14:51 by wolfgangriedmann