String Values

Say i want to ask a user to enter his name and IF his name is the name stored in the string type then i want to return something....Do i need to create a stringbuilder object to do this or can i just declare a string type like--->Tongue Tied

exp

string x;
x = Demetrius;

Console.WriteLine("Is your name Demetrius");
Console.Read(x)

if(x == Demetrius)
Console.WriteLine("hey Demetrius");
if(x != Demetrius)
Console.WriteLine("This not Demetrius")



Answer this question

String Values

  • jim and ebby

    Hi,


    The same as you other post. Just revise your code:

    string x;
    x = "Demetrius";

    Console.WriteLine("Is your name Demetrius");
    Console.Read(x)

    if(x == "Demetrius")
    Console.WriteLine("hey Demetrius");
    if(x != "Demetrius")
    Console.WriteLine("This not Demetrius")


    Just add "" to the strings...




    cheers,


    Paul June A. Domag

  • String Values