C
C#14mo ago
Ewan

✅ Higher or lower game, variable wont show inside the loop using console.write ;-; help please!

No description
6 Replies
Ewan
EwanOP14mo ago
on line 11 i have the variable "guesscount". But when i run it, the number 10, which is whats stored in that variable, doesnt show. Just the "Guesses Remaining" shows. why? help please! <:please_klee:1036669081870409828>
Hane
Hane14mo ago
try
Console.Writeline($"Guesses Remaining: {guesscount}");
Console.Writeline($"Guesses Remaining: {guesscount}");
Basically, Console.WriteLine doesn't take arguments they way JS's console.log does, for example. There are multiple ways to do it, this is just the most readable.
Ewan
EwanOP14mo ago
you're a legend, it works! thank you!
Hane
Hane14mo ago
What you did there is called "string interpolation", you may wanna read up on that. Other you could try for String.Format or stringbuilder - like I said, many ways to solve it. Useful read: https://learn.microsoft.com/en-us/dotnet/csharp/how-to/concatenate-multiple-strings
How to concatenate multiple strings (C# Guide) - C#
There are multiple ways to concatenate strings in C#. Learn the options and the reasons behind different choices.
Ewan
EwanOP14mo ago
thanks! will definitely have a look! :))) .close !close
Accord
Accord14mo ago
Closed!
Want results from more Discord servers?
Add your server