+ 2
How do I fix name console doesn't exist in current context(c#)?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) {string hello; hello= console.readline(); if (hello == "hi") { Console.WriteLine("Hello, Dcoder!");} } } }
7 odpowiedzi
+ 4
Prajanay Vyas
try the following:
//How do I fix name console doesn't exist in current context(c#)?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{string hello;
//Use this exactly on line 16
hello= Console.ReadLine();
//The rest is ok but need to add an else
if (hello == "hi")
//should add a conditional else otherwise No Output
{ Console.WriteLine("Hello, Dcoder!");} else { Console.WriteLine("Next time enter 'hi'");}
}
}
}
+ 3
Prajanay Vyas C# is case sensitive. You can't write Console to console and ReadLine to readline. You need to remember this.
+ 2
Console.ReadLine
capital letters!!!
+ 2
Thank you so much everyone
+ 2
It worked
+ 1
Then it says console doesn't contain defination of readline
+ 1
ReadLine()
uppercase letter, too