Isolate Posted April 28, 2014 Share Posted April 28, 2014 int[] parentIDs = {1,2,3,4}; public boolean parentIsValid() { boolean result = false; for(int i : parentIDs){ if(client.getInterface(i).isValid() || client.getInterface(i.isVisible()){ result = true; break; } } return result; } y u boolean inside boolean :'( Link to comment Share on other sites More sharing options...
Dreamliner Posted April 28, 2014 Share Posted April 28, 2014 y u boolean inside boolean :'( Because that's what the function returns. Link to comment Share on other sites More sharing options...
Isolate Posted April 28, 2014 Share Posted April 28, 2014 Because that's what the function returns. but if you're using it in an if statement why cant you just return true or false instead Link to comment Share on other sites More sharing options...
Dreamliner Posted April 28, 2014 Share Posted April 28, 2014 (edited) but if you're using it in an if statement why cant you just return true or false instead It's against convention to have more than one return per method. The reason of that, it to make debugging easier. You don't have your methods randomly exiting at different lines. Edited April 28, 2014 by dreamliner Link to comment Share on other sites More sharing options...
notdruid Posted April 28, 2014 Share Posted April 28, 2014 It's against convention to have more than one return per method. The reason of that, it to make debugging easier. You don't have your methods randomly exiting at different lines. Your code caused me to faceplam Link to comment Share on other sites More sharing options...
PolishCivil Posted April 28, 2014 Share Posted April 28, 2014 (edited) http://www.learnjavaonline.org/en/Arrays Edited April 28, 2014 by PolishCivil Link to comment Share on other sites More sharing options...
Swizzbeat Posted April 28, 2014 Share Posted April 28, 2014 How are you an SDN scripter? OSBot refuses to place restrictions because it's a "free market" Thats your opinion, also its just that this is the first time i've had to use an array list, i learn as i go Arrays are literally one of the first things you learn about in really any language. Link to comment Share on other sites More sharing options...
Soldtodie Posted April 28, 2014 Share Posted April 28, 2014 Int[] var = new int[] {22, 444, 777} Link to comment Share on other sites More sharing options...
Swizzbeat Posted April 28, 2014 Share Posted April 28, 2014 Int[] var = new int[] {22, 444, 777} int[] var = {22, 444, 777}; Link to comment Share on other sites More sharing options...
Soldtodie Posted April 28, 2014 Share Posted April 28, 2014 Int[] var = new int[] {22, 444, 777} ^^ but this works too. Link to comment Share on other sites More sharing options...
Isolate Posted April 28, 2014 Share Posted April 28, 2014 Int[] var = new int[] {22, 444, 777} ^^ but this works too. only reason id every use that = int[] var = new int[2]; var[0] = 22; var[1] = 444; var[2] = 777; Link to comment Share on other sites More sharing options...
Booch Posted April 28, 2014 Share Posted April 28, 2014 (edited) int[] String = new Char{ 2A3b, "???", 'c', false}; Always remember to use .equals() when comparing non-pr imitative datatypes(int, char, bool, etc) And use == OR != when comparing primitive data types(String, Objects etc) Edited April 28, 2014 by Booch Link to comment Share on other sites More sharing options...
Swizzbeat Posted April 28, 2014 Share Posted April 28, 2014 only reason id every use that = int[] var = new int[2]; var[0] = 22; var[1] = 444; var[2] = 777; With this post I'm questioning if you even know Java..... Link to comment Share on other sites More sharing options...
Deffiliate Posted April 28, 2014 Share Posted April 28, 2014 (edited) TBH my favorite way to do interfaces is to use an array of integer arrays. int[][] interfaces = {{150,1},{150,2},{350,6}}; Then for loop through the int [][]. public int[] getOpenInterface(int[][] interfacesToCheck){ for(int[] interface: interfacesToCheck){ if(getInterface(interface[0])!=null && getInterface(interface[0]).isValid() && getInterface(interface[1]).siValid()) return interface; } return null } Edited April 28, 2014 by Deffiliate Link to comment Share on other sites More sharing options...
BotRS123 Posted April 28, 2014 Share Posted April 28, 2014 How are you an SDN scripter? One of his scripts got approved and is now on the SDN. How he wrote that script, not a clue. Link to comment Share on other sites More sharing options...