Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes between Version 1 and Version 2 of DcharExample

Show
Ignore:
Author:
csauls (IP: 69.166.134.113)
Timestamp:
01/23/06 08:39:16 (18 years ago)
Comment:

Updated to use writef, and other miscellany.

Legend:

Unmodified
Added
Removed
Modified
  • DcharExample

    v1 v2  
    1616{{{ 
    1717#!d 
    18 void main() 
    19 {  
    20     dchar c = '0'; 
     18import std.stdio; 
     19 
     20void main () {  
     21  dchar c = '0'd; 
     22 
     23  /* Character literals must be quoted (no "naked" escape sequences allowed)  
     24   * If it was a string literal, quotes are optional. 
     25   */ 
    2126     
    22     if (c == '\U000000AA' || c == '\U000000BA')  
    23      
    24     /*  
    25         Character literals must be quoted (no "naked" escape sequences allowed)  
    26         If it was a string literal, quotes are optional. 
    27     */ 
    28      
    29         printf("True\n"); 
    30     else 
    31         printf("False\n"); 
     27  writefln("%s", cast(bit) (c == '\U000000AA'd || c == '\U000000BA'd)); 
    3228} 
    3329}}} 
    34  
    35 == Source == 
    36  
    37 || Link || http://www.dsource.org/tutorials/index.php?show_example=49 || 
    38 || Posted by || jcc7 || 
    39 || Date/Time || Thu Dec 2, 2004 6:52 pm ||