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 » Game Creation and Development » Scripters
Home Search
 

Re: Pretty Code

Previous Thread :: Next Thread 
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Dec 2012 05:49 PM
Does anyone else do this? I put my waits on the line above them like this:

chicken.Dead = true; wait(3)
chicken:Revive()

I also put meh ends like this:

if true then
if true then
if true then
end end end

Anyone else have weird habits too?
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
19 Dec 2012 05:52 PM
I disapprove of multiple ends on the same line.
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
19 Dec 2012 05:53 PM
I do neither and personally HATE more than 1 end on a line.

~ Moo logic = logical logic ~
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Dec 2012 05:54 PM
Really! I like it that way. I don't like long lines then short ones, I like it where they are almost equal lengths.

- thedestroyer115
Report Abuse
LPGhatguy is online. LPGhatguy
Forum Moderator
Joined: 27 Jun 2008
Total Posts: 4725
19 Dec 2012 05:54 PM
I like the idea of having one statement per line.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Dec 2012 05:55 PM
I must be a minority. >:p
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
19 Dec 2012 05:55 PM
@18c
high five

what I do that may or may not be considered strange would be ternaries. Absolutely unsure why I do it all the time; maybe because I hate the looks of:

  if foo == "bar" then
    foo = "bar"
  else
    foo = "foo"
  end
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
19 Dec 2012 05:56 PM
I tab my code so I can tell which end is for what.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Dec 2012 05:57 PM
I don't like indentation when there are multiple if thens right after each other. Like this:


if true then
if true then
if true then
--code
end
end
end


Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Dec 2012 05:58 PM
My indents didn't show up, lol.

- thedestroyer115
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
19 Dec 2012 06:00 PM
@the
to me they look great either way, but the biggest problem with the lack of indentation is the fact that ends line up with the actual if, when, while statements. Ever since I adopted the habit of tabbing (maybe two years ago? I didn't tab before around then) I've never gotten a single error of having too little or too many ends.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Dec 2012 06:07 PM
I haven't had syntax errors and I don't tab...
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
19 Dec 2012 06:18 PM
I used to not tab. I figured, "why should I tab when I don't have to?" I switched later though because it looked neater and readable and it gave me less stress and errors.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Dec 2012 06:19 PM
When I work with others on a project I will tab.
Report Abuse
SolarCrane is not online. SolarCrane
Forum Moderator
Joined: 03 Jul 2012
Total Posts: 116
19 Dec 2012 06:41 PM
If you don't like tabbing, you are in for a surprise if you start using python.

If you have multiple if thens directly after each other why not format like this:
if cond1 and cond2 and cond3 then

end

rather than:
if cond1 then
if cond2 then
if cond3 then
end end end

That is one thing i like to do.
Report Abuse
Aerideyn is not online. Aerideyn
Joined: 16 Jan 2010
Total Posts: 1882
19 Dec 2012 06:41 PM
I used to get bugs where i would mistakenly place an end on the wrong line when working with nested statements/loops and get my scopes all wrong.

while wait() do
if true then
for x=1,2 do
--some stuff
end
for y = 1,2 do
-- more stuff
end
end

is very different from

while wait() do
if true then
for x=1,2 do
--some stuff
for y = 1,2 do
-- more stuff
end
end
end

with tabbing that problem shows itself the moment you type it.. you save so much time not debugging.
(this is obviously a simple and visible example - sometimes these scope errors can be so obscure..)
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
19 Dec 2012 06:55 PM
Your ends are fantastic.
But usually when I use ; I use it to put a whole function on one line.

~Domo Arigoto Mr. Roboto
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Dec 2012 06:56 PM
I don't really find a difference, even in large scripts. When it does become a problem to me I might make some changes.
Report Abuse
VisualCSharp is not online. VisualCSharp
Joined: 23 Nov 2012
Total Posts: 225
19 Dec 2012 07:05 PM
I tab like this:
if true then
if true then
if true then
end
end
end
Report Abuse
VisualCSharp is not online. VisualCSharp
Joined: 23 Nov 2012
Total Posts: 225
19 Dec 2012 07:09 PM
No tabs. Darn:
Pastebin:
pastebin dot com slash T2H9Q4Mv
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
19 Dec 2012 09:45 PM
Idk why, but I've always liked tenal, if you dare go back to C&G, I'd probably not care.

*Late high five*

~ Moo logic = logical logic ~
Report Abuse
MrBlockson is not online. MrBlockson
Joined: 31 Aug 2008
Total Posts: 14276
20 Dec 2012 08:12 AM
Seeing as I tab EVERYTHING, ends go the same amount of tabs out as the opening statement. In Java, the opening brace also goes on the same line as the opening statement as I see them as the same thing. "{" is analogous to "then" or "do" and "}" is analogous to "end"
Report Abuse
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
20 Dec 2012 09:20 AM
Wrong:

if(true) {
System.out.println("!")
}

Is equivalent to:

if(true)
{
System.out.println("!")
}
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
20 Dec 2012 09:29 AM
Try this one out, lol

if
true
then
print
"Hello world!"
end
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
20 Dec 2012 10:08 AM
I tab each control structure in, (Which is common across all languages), and it helps you read the structure of the code.

Also, if you don't tab in your code, you ARE in for a surprise when you try to work professionally or you work on a large project.

Please, tab stuff in.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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