I'm creating an OS in cosmos ( C# ) , but I cannot get the code right. Here it is:
var input = Console.ReadLine();
if (input = 'h')
Console.Write("This is the help section...");
else
Console.Write("Invalid Command.");
Console.WriteLine(input);
What I want it to do is that when I type in 'H' it should output the help section and when I type in something else, it should type in 'Invalid Command'.
It keeps saying 'Error: Cannot implicitly convert type 'char' to 'string'.
Full code
using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;
namespace Dingo_OS
{
public class Kernel : Sys.Kernel
{
protected override void BeforeRun()
{
Console.WriteLine("Thank you for trying out my OS. For any help, input /h.");
}
protected override void Run()
{
var input = Console.ReadLine();
if (input = 'h')
Console.Write("This is the help section...");
else
Console.Write("Invalid Command.");
Console.WriteLine(input);
}
}
}