I don't understand a bit if syntax in one of the question solutions.
You have to make a console application which reverses a strings order and the solution is here:
Code:
static void Main(string[] args)
{
Console.WriteLine("what is your name?");
string input1;
string reversedString = "";
input1 = Console.ReadLine();
for (int index = input1.Length -1; index >= 0; index --)
{
reversedString += input1[index];
}
Console.WriteLine("Your name reveresed is: {0}", reversedString);
Console.ReadKey();
}
Now I understand everything apart from the syntax of one line which I might have overlooked in the chapter but I browsed through and couldn't see it explained so a point in the right direction would be good.
The line I don't understand is:
Code:
reversedString += input1[index];
I get that it is saying find the character corresponding to the index number and place it in reversedString but I do not understand:
As I am going through this book intermitently I overlooked it at first and thought it was an explicit conversion but after thinking about it you still output a string so it isn't converting anything it is just assigning the letter based on its indexed value.
It just isn't described in the chapter from what I can see; how this works and what you can use it with so could anybody tell me what this is called/how it works or tell me where in the book it talks about this?