C
C#•3w ago
Tech.py |

A Bug I Encountered

So I'm new to C# and I was learning but I got this bug in this Code i wans tryna make guess the number game.
// Online C# Editor for free
// Write, Edit and Run your C# code using C# Online Compiler

using System;

public class HelloWorld
{
public static void Main(string[] args)
{
Console.WriteLine("[-----Welcome to Guess The Number Game-----]");
Random random = new Random();
int min = 0;
int max = 100;
bool playAgain = true;
int guess;
int guesses;
int number;

while (playAgain)
{
guess = 0;
guesses = 0;
number = random.Next(min, max + 1);
while (guess != number)
{
Console.Write("Enter Your Guess: ");
Console.ReadLine();

if (guess < number)
{
Console.WriteLine("Go High!");
}
else if (guess > Number)
{
Console.WriteLine("Go Low!");
}
guesses++;
}
Console.WriteLine($"You Guessed the Number {guess} in {guesses} Tries!");
}
}
}
// Online C# Editor for free
// Write, Edit and Run your C# code using C# Online Compiler

using System;

public class HelloWorld
{
public static void Main(string[] args)
{
Console.WriteLine("[-----Welcome to Guess The Number Game-----]");
Random random = new Random();
int min = 0;
int max = 100;
bool playAgain = true;
int guess;
int guesses;
int number;

while (playAgain)
{
guess = 0;
guesses = 0;
number = random.Next(min, max + 1);
while (guess != number)
{
Console.Write("Enter Your Guess: ");
Console.ReadLine();

if (guess < number)
{
Console.WriteLine("Go High!");
}
else if (guess > Number)
{
Console.WriteLine("Go Low!");
}
guesses++;
}
Console.WriteLine($"You Guessed the Number {guess} in {guesses} Tries!");
}
}
}
this is the bug /tmp/U4hqnIdafR/Main.cs(34,34): error CS0122: 'Number' is inaccessible due to its protection level
5 Replies
Tech.py |
Tech.py |OP•3w ago
and dont ask me y im using web editor 💀
Insire
Insire•3w ago
capitalization matters in c#
Tech.py |
Tech.py |OP•3w ago
wdym
Insire
Insire•3w ago
that you got a capitalization error
Tech.py |
Tech.py |OP•3w ago
oh i saw thx man these minute things 💀
Want results from more Discord servers?
Add your server