Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

A string variable for an if condition

gplaylegplayle Member
edited September 2022 in Programming

Okay, I know how to code a number variable, like

int num = Convert.ToInt32(Console.ReadLine());

for when you are making an if statement and want the user to input a number, but how do I write code for a string if I want the user to input text?

string s1 = Convert.ToString(Console.ReadLine());

would that be correct? Or maybe I'm way off...?

Sign In or Register to comment.