generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Club Houses » Let's Make a Deal
Home Search
 

Re: Anyone fluent in Java

Previous Thread :: Next Thread 
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:12 PM
I'm a beginner
have a question

which line is invalid

if (x < 5) x++;
if (x < 5) { x++; }
if x < 5 x++;
if (x < 5) if (x > 0) x++;

I want to say the last one cause it says if twice and doesn't say else if

but the brackets around x++; in b are making me question it.
Report Abuse
TheFreshCrew is not online. TheFreshCrew
Joined: 05 May 2012
Total Posts: 15820
07 Oct 2015 11:13 PM
Shouldnt C need brackets around x<5 to specify the inequality
Report Abuse
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:14 PM
seems too obvious to me, I'm also learning about if and else if right now so it's probably throwing me off.
Report Abuse
stal477 is not online. stal477
Joined: 15 Jun 2009
Total Posts: 15729
07 Oct 2015 11:15 PM
wtf r u talkin about



- Known as Stal447 - // Add 11k posts to my count // 788,753 // - RSTF NFT -
Report Abuse
TheFreshCrew is not online. TheFreshCrew
Joined: 05 May 2012
Total Posts: 15820
07 Oct 2015 11:15 PM
Are u learning from codecademy?
Report Abuse
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:16 PM
@stal
Java
I'm learning programming and need some help on one question
Report Abuse
Xaleo is not online. Xaleo
Joined: 13 Apr 2009
Total Posts: 11864
07 Oct 2015 11:16 PM
I think its the second one because the ; should always come at the end right?
I'm not sure really.
Report Abuse
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:16 PM
No I'm taking a class with my online school Connections.
It's a Pearson ebook.
Report Abuse
TheFreshCrew is not online. TheFreshCrew
Joined: 05 May 2012
Total Posts: 15820
07 Oct 2015 11:17 PM
Yeah its either B or C but i personally think C
Report Abuse
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:17 PM
@Xal
That's why I was trying to decide between b and c.
c should have extra brackets if it wants to state if twice in a row like that
Report Abuse
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:17 PM
b or d* sorry
Report Abuse
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:19 PM
gonna say b because I really don't think the bracket should be on the inside, I know it shouldn't, I just don't know if I missed something somewhere hence why I'm asking
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
07 Oct 2015 11:19 PM
It's a lot easier when u have line breaks

But c wouldn't work
D works if 0 < x < 5

If you have the lines, you'll probably see it better

Checks first of
If true, goes in, checks second
If true, goes in and outputs
Report Abuse
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:20 PM
@L2
that's all I have.
But yeah the parenthesis makes sense too.
Explain how B can work then, since the bracket is inside the parenthesis?
Report Abuse
TheFreshCrew is not online. TheFreshCrew
Joined: 05 May 2012
Total Posts: 15820
07 Oct 2015 11:20 PM
ya its C
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
07 Oct 2015 11:21 PM
And basically, the brackets mean you're in an if, loop, function, ...
If it's just one line you don't need them, but you can still put them in and it'll work
Report Abuse
Axarthian is not online. Axarthian
Joined: 31 Jul 2011
Total Posts: 41927
07 Oct 2015 11:21 PM
C
Report Abuse
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:22 PM
alright, sounds good thank you
Report Abuse
TheFreshCrew is not online. TheFreshCrew
Joined: 05 May 2012
Total Posts: 15820
07 Oct 2015 11:23 PM
U can also eliminate C since A and C are the same, but one has parenthesis and one doesn't, meaning one of them cant be right
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
07 Oct 2015 11:25 PM
Think of it like a is b, but b is safer
If you add more later you'll need those brackets
Otherwise you can come into problems

A lot of ppl just put them in go be safe
Doesnt matter either way

D is a different condition
C needs ()
Report Abuse
nuke98 is not online. nuke98
Joined: 16 Jul 2008
Total Posts: 25506
07 Oct 2015 11:27 PM
Okie dokie, makes sense now kitty. Thanks much you guys :)
Report Abuse
Cizox is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
07 Oct 2015 11:29 PM
D
Report Abuse
Cizox is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
07 Oct 2015 11:31 PM
wouldnt d just error since its trying to say if both x < 5 and x > 0 but instead if makes 2 if statements
Report Abuse
jrjojo is not online. jrjojo
Joined: 14 Sep 2008
Total Posts: 30402
07 Oct 2015 11:31 PM
c
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
07 Oct 2015 11:35 PM
It's the same thing, just && looks better and is faster to write
If you wanted an else on the second if tho u can split it up like that
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Club Houses » Let's Make a Deal
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image