C
C#6mo ago
cheemus1

Microsoft.learn solution?

Hi Im currently working my way through the lessons on this platform. I have come to the section where you learn about string interpolation and character escape sequences. I was given the code challenge in the pictures i have provided. I have provided my solution and the solution that the platform suggested. My solution was correct, but, when I seen the solution provided by the platform, it didn't seem to be as concise as the one I used. I was just wondering if anyone can tell me if my code is better or is there something I am missing?
No description
No description
No description
No description
4 Replies
Moods
Moods6mo ago
It's the same thing, id say theirs is more concise cus they used escape sequences (the \n and \t you see) to specify a newline and tab. And while you passed the path as a literal to Console.WriteLine, they put it in string variables (englishLocation and russianLocation) and used interpolation to display it Also I wasn't aware verbatim strings(@) captured whitespace in the source code file tbh
cheemus1
cheemus16mo ago
Ah yes I can see that now, thanks for the response. I think at the time I just seen that they had more lines of code to do the same thing, so I presumed that it wasn’t as concise. I can see now that what makes it more concise is having less keystrokes and more readable when it comes to actually executing the code….is that correct?
Moods
Moods6mo ago
In my opinion yeah, I’d say those two things made it more concise. Especially the readability
cheemus1
cheemus16mo ago
Thats great thanks for your help, very much appreciated