Jump to content

If statement is unreachable?


Dab in a Lab

Recommended Posts

Can anyone tell me why this statement is unreachable? If I mess around with the brackets to get the statement reachable, the else statement isn't paired with any if statements anymore. Its on line 43

https://gyazo.com/c840ffe12d80c78008ce9c1f6f1cc31c

And if anyone could give me feedback or pointers for the code I have right now, that would be really appreciated. 

https://github.com/Dab-in-a-Lab/Wilderness-Looter/blob/master/Current Code

Link to comment
Share on other sites

14 minutes ago, Theorems said:

Looks a bit messy... Are you declaring a method in your onLoop()? also you have a return statement right after you declare the method so all the code that follows in unreachable. Also what's with the random curly brackets on line 41? that could also be causing issues.

Hahaha ya, I quickly realized I was a little too ambitious with this script. Only just started learning how to code this week, and the project seemed easy enough until I actually got a bit further into it ?

I fixed the return statement and I honestly don't know why the curly bracket was there, I think it was attached to the end of line 40?

It seems to be working for now, thank you.

  • Like 1
Link to comment
Share on other sites

22 minutes ago, Dab in a Lab said:

Hahaha ya, I quickly realized I was a little too ambitious with this script. Only just started learning how to code this week, and the project seemed easy enough until I actually got a bit further into it ?

I fixed the return statement and I honestly don't know why the curly bracket was there, I think it was attached to the end of line 40?

It seems to be working for now, thank you.

Good luck with the script! you're doing really well for someone who is just learning

  • Heart 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...