
/* 
	File:      conditional.d
	Author:    Justin C. Calvarese, jccalvarese@yahoo.com
	Website:   http://jcc_7.tripod.com/d/
	License:   Public Domain

	This was written to demonstrate bugs in the DMD compiler.
	It was fixed in the DMD 0.75 compiler. 
*/

int main()
{

    char[] c = "Hello";
    printf(c ~ "\n");
    printf("         \t     v\t\"is first\" used to be missing...\n");
    printf("Answer...\t" ~ cast(char[]) ((c[0..1] == "H") ? "H is first" : "not H" ) ~ "\0");
    printf("\n");
    printf("Answer...\t" ~ cast(char[]) ((c[0..1] <> "H") ? "not H" : "H is first" ) ~ "\0");
    printf("\n\n");

    c = "No H begins this one.";
    printf(c ~ "\n");
    printf("Answer...\t" ~ cast(char[]) ((c[0..1] == "H") ? "H is first" : "not H") ~ "\0");
    printf("\n");
    printf("Answer...\t" ~ cast(char[]) ((c[0..1] <> "H") ? "not H" : "H is first" ) ~ "\0");
    printf("\n\n");


    c = "Hello";
    printf(c ~ "\n");
    printf("Answer...\t" ~ ((c[0..1] == "H") ? cast(char[]) "H is first" : "not H") ~ "\0");
    printf("\n");
    printf("Answer...\t" ~ ((c[0..1] <> "H") ? cast(char[]) "not H" : cast(char[]) "H is first") ~ "\0");
    printf("\n\n");

    c = "No H begins this one.";
    printf(c ~ "\n");
    printf("Answer...\t" ~ ((c[0..1] == "H") ? cast(char[]) "H is first" : cast(char[])  "not H" ) ~ "\0");
    printf("\n");
    printf("Answer...\t" ~ ((c[0..1] <> "H") ? cast(char[]) "not H" : cast(char[]) "H is first" ) ~ "\0");
    printf("\n\n");


  ™]\›ˆ