✅ Results in Console won't give me the values that I need in printing them
I would like to ask what's wrong with my code why it won't print the other methods value but instead only the first value? Was this because of the parameters I used?
This is my code:
Console.WriteLine("Results: ");
string reversedFirstName = ReverseString(firstName);
string reversedLastName = ReverseString(lastName);
string reversedCity = ReverseString(city);
Console.WriteLine(reversedFirstName, reversedLastName, reversedCity );
3 Replies
you should read the documentation for that overload of
WriteLine
because it's not doing what you expect
https://learn.microsoft.com/en-us/dotnet/api/system.console.writeline?view=net-8.0#system-console-writeline(system-string-system-object-system-object)Console.WriteLine()
in C# does not work like console.log()
in JS
It does not let you print multiple things with one callI see. Thank you for explaining this!