C
C#8mo ago
Ewan

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

No description
6 Replies
Ewan
Ewan8mo 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
Hane8mo 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
Ewan8mo ago
you're a legend, it works! thank you!
Hane
Hane8mo 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
Ewan8mo ago
thanks! will definitely have a look! :))) .close !close
Accord
Accord8mo ago
Closed!
Want results from more Discord servers?
Add your server
More Posts
✅need help!! (very very new to c#)hello! for my assignment, my teacher has asked that we keep track of values assigned to a double exc❔ error: Unable to create a 'DbContext' of type '' ". When adding migration to MySQL databasehi there! im just starting a webapi project and i wanted to use a mysql docker container and go cod❔ Visual Studio not detecting .NET 7I have installed the .NET 7 SDK, but its not showing up (I have run `dotnet sdk check`)KeyNotFoundException: The given key was not present in the dictionary.Hey guys. I am attempting to send paramaters over to another method in a different file and im getti❔ Garbage collection questionI see in many libraries examples where in DI ".AddScoped<>", ".AddTransient<>" is used instead of ".❔ CS0123No overload for 'CanvasMain_PreviewMouseMove' matches delegate for 'EventMouseHandler'Basically i'm trying to make a system where there is a grid with moveable objects - if you drag the ❔ EntityFramework - How do I figure out what ORM expects?```#region Assembly AgeOfSailOnline_DB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null // Age❔ what learn first as beginerr blazor or asp.neti want to go web dev route with c# and i am confused what is better learn first asp.net or blazor✅ Two calls to same microservice inside one transactionGreetings, I have a .NET Core Web client that is accessing a .NET Core API microservice (that uses ❔ Asynchronously events handling flowHi, I am writing a bot and I don't know how to organize events handling with tasks. I have class th