Jump to content

HELP!!!!

- - - - -

  • Please log in to reply
5 replies to this topic

#1
majorawsome

majorawsome

    Newbie

  • Members
  • Pip
  • 5 posts
ok, so i have my code but when the if statement is over i would like to go back to a line of code BEFORE the if statement. help?

#2
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
Could you post some code so we could see what you mean?
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.

#3
artificial

artificial

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 624 posts
You could use goto if C# has something like that (I know that it's frowned upon, but it might solve your problem).

Greets,
artificial
Sometimes words ain't enough to express something. That's why computer scientists use double words.

#4
majorawsome

majorawsome

    Newbie

  • Members
  • Pip
  • 5 posts
Here's the code. i already tried goto(thats why its in a comment because i comment mistakes out so i can see what worked and what didn't)
[Code] //Commands;
String CommandsTrigger = Console.ReadLine();
if (CommandsTrigger == "HELP")||
(CommandsTrigger == "help")||
(CommandsTrigger == "Help")
{
Console.WriteLine("Clear | Clears console");
Console.WriteLine("About | Shows information");
Console.WriteLine("Game | Play Guess the Number");
String Activity = Console.ReadLine();
if (Activity == "Clear")
{
Console.Clear;
//goto case Commands;
}
if (Activity == "About")
{
Console.WriteLine("Operating system: Nova 1 Black Viper");
Console.WriteLine("Created by Austin DeLauney");
Console.WriteLine("Uses COSMOS boot kernel");
//goto case Commands;
}[/Code
]

#5
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
Interesting code. I haven't worked with console for a while but try this code:
static void Main(string[] args)
        {
            Console.WriteLine("Clear | Clears console");
            Console.WriteLine("About | Shows information");
            Console.WriteLine("Game | Play Guess the Number");
            while (true)
            {
                


                String CommandsTrigger = Console.ReadLine();
                
                if ((CommandsTrigger == "HELP") || (CommandsTrigger == "help") || (CommandsTrigger == "Help"))
                {
                    Console.WriteLine("Clear | Clears console");
                    Console.WriteLine("About | Shows information");
                    Console.WriteLine("Game | Play Guess the Number");

                }
                else if (CommandsTrigger == "Clear")
                {
                    Console.Clear();
                    //goto case Commands;
                }
                else if (CommandsTrigger == "About")
                {
                    Console.WriteLine("Operating system: Nova 1 Black Viper");
                    Console.WriteLine("Created by Austin DeLauney");
                    Console.WriteLine("Uses COSMOS boot kernel");
                    //goto case Commands;
                }

            }
        }

A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.

#6
majorawsome

majorawsome

    Newbie

  • Members
  • Pip
  • 5 posts
THANKS! i am making an operating system with cosmos. i had a lot of code so i didn't want to put the whole thing in so i put that snippet in to see what your method was for doing it




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users