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: What means 'return ' and 'break'

Previous Thread :: Next Thread 
xXLuka_XD is not online. xXLuka_XD
Joined: 27 Mar 2016
Total Posts: 296
27 Nov 2016 12:01 PM
Can somebody explain?
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
27 Nov 2016 12:02 PM
break will break the statement.

return will return a statement.


Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
skydude221 is not online. skydude221
Joined: 15 May 2013
Total Posts: 5014
27 Nov 2016 12:02 PM
they mean what they say
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
27 Nov 2016 12:03 PM
http://wiki.roblox.com/index.php?title=Loops#Break

http://wiki.roblox.com/index.php?title=Function#Using_Return


Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
xXLuka_XD is not online. xXLuka_XD
Joined: 27 Mar 2016
Total Posts: 296
27 Nov 2016 12:05 PM
i mean can you explain what return does and break does? I am newbie , so i dont know
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
27 Nov 2016 12:06 PM
http://wiki.roblox.com/index.php?title=Loops#Break

http://wiki.roblox.com/index.php?title=Function#Using_Return

^That


Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
Baheegv2 is not online. Baheegv2
Joined: 17 Oct 2016
Total Posts: 959
27 Nov 2016 12:08 PM
Imagine that you asked your friend to go and do something everyday for you, which would cost you around 5 bucks

and then 1 day you wanted to stop that procedure, so you would tell him to >STOP< or >BREAK< the act

that's what a break is, you have something that loops and repeats, but you wanna break or stop that loop

as for return, let's say that you were sent 2 packages instead of 1 by mistake, and you'd like to return a message/ or the package itself that you were sent 2 by mistake

That's >RETURNING< info/items in this case

this is exactly what happens in lua, you return information to the caller or the user or the client or w/e you wanna call it, after you have done changes to it or after you have received it yourself


Report Abuse
xXLuka_XD is not online. xXLuka_XD
Joined: 27 Mar 2016
Total Posts: 296
27 Nov 2016 12:09 PM
Thanks ! :D
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
27 Nov 2016 12:20 PM
local function Add(a,b)
return a+b
end
Add(2,3) -- This is equal to five. It returns the 'a+b'

Here's a bit more complex example:

local function Fact(n)
if n==1 then
return n
else
return Fact(n-1)*n
end
end

print(Fact(4))-- Returns 24
print(Fact(5))-- Returns 120


Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
Baheegv2 is not online. Baheegv2
Joined: 17 Oct 2016
Total Posts: 959
27 Nov 2016 12:20 PM
No point in returning if you're not going to refer to the result @caca


Report Abuse
Baheegv2 is not online. Baheegv2
Joined: 17 Oct 2016
Total Posts: 959
27 Nov 2016 12:21 PM
mb didn't see the bottom part ;v




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