C
C#ā€¢7d ago
naoto

āœ… need some help making a program

buuuuuuuuuuut im getting errors idk how to fix
No description
105 Replies
naoto
naotoā€¢7d ago
No description
naoto
naotoā€¢7d ago
changed it slightly
No description
Buddy
Buddyā€¢7d ago
How do you set the value of a variable? and how do you check if a value is equals to another value?
naoto
naotoā€¢7d ago
you just.. use =? ==..? im trying to get it to return false if the email doesnt have a @ and a .
Buddy
Buddyā€¢7d ago
Correct and check your code
naoto
naotoā€¢7d ago
ok
Buddy
Buddyā€¢7d ago
Read it out for yourself
Buddy
Buddyā€¢7d ago
if and switch statements - select a code path to execute - C# refer...
The if and switch statements provide branching logic in C#. You use if, else and switch` to choose the path your program follows.
naoto
naotoā€¢7d ago
but apparently..
No description
Buddy
Buddyā€¢7d ago
compare your if statement to what you wrote earlier Setting the value versus comparing a value
naoto
naotoā€¢7d ago
all i did was add a space to else if and change the = to ==
No description
Buddy
Buddyā€¢7d ago
And one more thing. Compare the example given in the microsoft documentation Last thing You have a character in your code that does not exist in the example
naoto
naotoā€¢7d ago
im ngl i dont understand the documentation at all i leant c# in 3 hours for school the basic basics ofc
Buddy
Buddyā€¢7d ago
if (char.IsUpper(ch))
{
Console.WriteLine($"An uppercase letter: {ch}");
}
else if (char.IsLower(ch))
{
Console.WriteLine($"A lowercase letter: {ch}");
}
else if (char.IsDigit(ch))
{
Console.WriteLine($"A digit: {ch}");
}
else
{
Console.WriteLine($"Not alphanumeric character: {ch}");
}
if (char.IsUpper(ch))
{
Console.WriteLine($"An uppercase letter: {ch}");
}
else if (char.IsLower(ch))
{
Console.WriteLine($"A lowercase letter: {ch}");
}
else if (char.IsDigit(ch))
{
Console.WriteLine($"A digit: {ch}");
}
else
{
Console.WriteLine($"Not alphanumeric character: {ch}");
}
Do you see any semicolons in the if-statement?
naoto
naotoā€¢7d ago
nope huh
Want results from more Discord servers?
Add your server