+ 1
Can someone explain what's happening here?
So this is the final question of the chapter "Working with Strings": Fill in the blanks to assign the last character of the string to the x variable: string s = "Hello"; char x; x = _ [s.Length-1 _; I get that you have to close the brackets and I guessed that the other space was "s" . But i literally guessed it. That last line of code is messing me up. Can someone explain to me why this code ( x = s [ s.Length-1]; ) is correct? Thanks and sorry for the mediocre english.
2 Réponses
+ 2
x =s[s.Length - 1];
This is the easy answer
+ 1
Thank you! I was at a loss and now i feel really dumb. That was a really nice explanation.