How to check two arguments at once?

Discussion in 'Plugin Development' started by blok601, Oct 18, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    blok601

    How would I check if there are two arguments and the first argument equals something?
     
  2. Offline

    robin2310

    Code:
    if (args[0].equalsIgnoreCase("Bla") {
        if (args[1].equalsIgnoreCase("Bla2") {
            // do something
        }
    }
    Isn't that it?
     
  3. Offline

    tkuiyeager1

    Code:
    if(args.length == 2) { // Checks the arguments lenght
        if(args[0].equalsIgnoreCase("something") { // Checks if the first arg is equals to something
            // Do What You Need
    }
     
    blok601 likes this.
  4. Offline

    blok601

    Trying it right now.
     
  5. Offline

    tkuiyeager1

  6. Offline

    SuperSniper

    @blok601 You could also do this if you don't want to put lots of closed curly brackets :p

    Code:
    if(args.length == 2) && args[0].equalsIgnoreCase("something") & args[1].equalsIgnoreCase("somethingelse")) {
    // Do stuff
    [/code
     
Thread Status:
Not open for further replies.

Share This Page