IcyFires
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 5046 |
|
|
| 08 Oct 2014 09:35 PM |
Use the repeat with an if statement before it
if true then repeat wait() print("ok") until not true end
is the same as:
while wait() do print("ok") end |
|
|
| Report Abuse |
|
|
Nyxis
|
  |
| Joined: 15 Nov 2012 |
| Total Posts: 3374 |
|
|
| 08 Oct 2014 09:36 PM |
Give this man a pat on the back, a cookie, and a kick in the face.
a seal walked into a club |
|
|
| Report Abuse |
|
|
IcyFires
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 5046 |
|
|
| 08 Oct 2014 09:47 PM |
| You guys all know how much I love repeat loops and hate while loops. So I finally put in the seconds of thought to make it work. |
|
|
| Report Abuse |
|
|
IcyFires
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 5046 |
|
| |
|
|
| 08 Oct 2014 09:48 PM |
i didn't know that and don't know why you feel that. lol
this is a signature: pcall(function() print([[apparently this is a string]]) end) |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 09:49 PM |
well at least youre learning most people here just beg |
|
|
| Report Abuse |
|
|
IcyFires
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 5046 |
|
|
| 08 Oct 2014 09:51 PM |
| ^I already know how to script pretty advanced. I just thought of this today since I fell in love with repeat loops at like 2:00 this afternoon. |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 09:51 PM |
^ Savor your next post, do it for Jordan.
-Vanilla |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 08 Oct 2014 09:51 PM |
| Track this thread and look back on it in a year from now. |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 09:51 PM |
sounds like me and my brother falling in love with calculus around 2am as well fun stuff |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 09:53 PM |
*tracks thread* *1 year later* -[Content Deleted]- |
|
|
| Report Abuse |
|
|
IcyFires
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 5046 |
|
|
| 08 Oct 2014 09:55 PM |
| I vow to never use a while loop again. |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Oct 2014 09:57 PM |
but, icy. this is pretty inefficient compared to a while loop. they were created for a reason.
this is a signature: pcall(function() print([[apparently this is a string]]) end) |
|
|
| Report Abuse |
|
|
IcyFires
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 5046 |
|
|
| 08 Oct 2014 09:58 PM |
| I guess you could say I am a coding hipster. |
|
|
| Report Abuse |
|
|
Subete
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 917 |
|
| |
|
|
| 08 Oct 2014 09:59 PM |
'coding hipster'
ahhaaahhaahahahhaahaha. icy ur killing me. ahahahaahahahahhaha
*died*
rest in piece kotwarrior |
|
|
| Report Abuse |
|
|
Subete
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 917 |
|
|
| 08 Oct 2014 10:00 PM |
| KOT really did die... he forgot to put his signature |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 10:01 PM |
You're just like instagram hipsters using filters to make their pictures look better, except a lot more intelligent.
Oh god. While loop filters aaaaaaah.
-Vanilla |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 10:03 PM |
It will be much harder to decode a error if someone else sees this loop and need to understand the reason behind this
And I don't believe you need the "if true then" part of the script |
|
|
| Report Abuse |
|
|
IcyFires
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 5046 |
|
|
| 08 Oct 2014 10:05 PM |
| Legend, yes you do. Repeat loops run the block of code before checking the condition, so you need to check it prior to you running the loop to get the same functionality as a while loop. |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 10:07 PM |
instead of that you could do:
repeat wait() print(true and "ok" or ''); until not true; |
|
|
| Report Abuse |
|
|
IcyFires
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 5046 |
|
|
| 08 Oct 2014 10:09 PM |
| You need an if statement though or else even if the until is true it will run once. |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 11:26 PM |
A repeat loop is just simply a do while loop, which is essentially a while loop that runs at least once. repeat wait() until false
is also just fine |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
| |
|