|
| 13 Jul 2017 03:27 PM |
are they a thing yet
if not add em
- Simp |
|
|
| Report Abuse |
|
|
| |
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 13 Jul 2017 04:03 PM |
http://wiki.roblox.com/index.php?title=Loops#Repeat
Basically works the same way. |
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 13 Jul 2017 04:23 PM |
Just to clarify(for some reason I always feel compelled to do this) when I say basically I mean It does the same thing, but the name is different. :P
So instead of do...while it's repeat...until, but functionally they are identical. |
|
|
| Report Abuse |
|
|
Zawie
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 6338 |
|
|
| 13 Jul 2017 04:24 PM |
while (condition) do --code end |
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 13 Jul 2017 04:34 PM |
| He wanted do...while not while...do. There is a difference in that while evaluates the condition first before executing the contents of the loop. do...while will always execute the code in the loop at least once. repeat...until works the same way as do...while. |
|
|
| Report Abuse |
|
|
Zawie
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 6338 |
|
|
| 13 Jul 2017 04:36 PM |
ah
repeat -- code until (condition)
|
|
|
| Report Abuse |
|
|
|
| 13 Jul 2017 05:25 PM |
No...
In C++ there is while loops, also do while loops:
do {
} while (condition)
- Simp |
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 13 Jul 2017 05:41 PM |
@SimplifiedCode, yes and the functional equivalent of this in Lua is repeat...until
They do the same thing just have different names. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2017 05:43 PM |
That wouldn't do the same thing. it would repeat it, not do it once and then check if it was "Right"
- Simp |
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 13 Jul 2017 05:50 PM |
http://wiki.roblox.com/index.php?title=Loops
No, it executes the code within the loop once and then checks the condition to see if it evaluates to true. This IS the exact same things do...while loops do...
in Lua:
local i = 0 repeat i = i + 1 until (i == 10)
in C++:
int i = 0; do { i++; } while(i < 10);
Is functional identical. Lua doesn't need to add do...while loops because it has repeat...until. Which works MORE OR LESS the same. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2017 05:53 PM |
No...
local i = 0 repeat i = i + 1 until (i == 10)
> Checking Repeats 10 times
int i = 0; do { i++; } while(i < 10);
> Repeats 10 times then checking.
- Simp |
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 13 Jul 2017 06:00 PM |
In both the condition is always evaluated after every iteration of the loop.
local i = 0 print(i) i = i + 1 until (i == 3)
will print 0 regardless as the loop is executed before the condition is checked
execute loop > check condition > i == 3? yes: end, no: execute loop |
|
|
| Report Abuse |
|
|
| |
|