greptilian logo

IRC log for #friendlyjava, 2016-11-14

##friendlyjava on freenode

| Channels | #friendlyjava index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

All times shown according to UTC.

Time S Nick Message
07:48 takyashi joined ##friendlyjava
08:23 takyashi joined ##friendlyjava
17:01 JZA joined ##friendlyjava
17:01 JZA hi friendly people, I want some help with some code.
17:01 JZA https://pastebin.mozilla.org/8928192
17:01 JZA I am trying to get this while loop to work.
17:02 JZA the code is working for the most part just the end, where the loop doesnt exit.
17:13 takyashi joined ##friendlyjava
17:18 aditsu JZA: hi, I'll take a look
17:18 JZA cool, thanks.
17:22 aditsu huh, lots of things to comment on... let's start with the logic
17:23 aditsu you have a password, and you're doing 3 tests to see if it's valid, right?
17:23 JZA ok but this is what I need. I just need to when it returns "Valid password" it will finalize the loop.
17:23 aditsu well, it never gets to the part where it says "Valid password"
17:23 JZA yes, the conditionals work, the functions work, the only issue I am having is with the while loop on line 18
17:24 JZA read the comments of how is behaving
17:24 aditsu read what I just said :)
17:24 JZA the only thing I need is that when is succesful, it print out Valid password (which it does) and then exit the loop.
17:24 JZA it does get to that part thought.
17:24 aditsu no it doesn't
17:25 JZA after printing valid password it ask again 'enter password'
17:25 aditsu it never prints valid password
17:25 JZA and thats when i want to break.
17:26 aditsu it never gets there, that part is after the loop
17:26 JZA but if it was after the loop why does it ask to enter the password again.
17:26 aditsu because it repeats the loop
17:27 JZA ummm that didnt make sense, if it prints valid password which you said is outside of the loop, why would it go back to 'enter password'.
17:27 aditsu it does NOT print valid password, I told you 3 times already
17:28 JZA one sec
17:28 aditsu it never ever ever never ever prints valid password
17:29 aditsu never
17:29 JZA one sec let me update the pastebin
17:30 JZA https://pastebin.mozilla.org/8928203
17:31 aditsu ok, that's different
17:31 aditsu JZA: so, what do you think should cause the loop to break in this code?
17:32 JZA well if I put break it will break regardless if its succesful or not.
17:32 aditsu depends where you put it
17:32 JZA after the Valid password
17:33 JZA or what do you suggest
17:33 JZA ok I just put it and it stops on the first condition.
17:34 aditsu the way the code is written, after the "valid password" line it is already outside of the if
17:34 aditsu do you know how to execute multiple statements with an if?
17:36 JZA usually just semicolon and write the next line before the closing '}' isn't it?
17:36 aditsu well, you don't have a '{' for the if
17:36 JZA true
17:37 aditsu and yes, you can use a block after the if, to execute multiple statements
17:37 JZA I know
17:37 JZA so I need one { .. System.out.println("Valid password"); return; } ? or what should it be?
17:38 aditsu you can try
17:40 JZA ok that worked, thanks. :)
17:40 JZA awesome dude.
17:40 aditsu you're welcome; there are still many ways to improve your code
17:40 aditsu but at least it works
17:59 JZA left ##friendlyjava
18:59 mr_lou joined ##friendlyjava
22:34 pdurbin aditsu: good job

| Channels | #friendlyjava index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

##friendlyjava on freenode