|
| 30 Oct 2012 04:48 PM |
| Does return end a function like in many other languages? |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Oct 2012 04:48 PM |
| Oh yeah, return is a major key word in programming. Without it, functions like math.random(), pairs, wouldn't exist. No major functions wouldn't exist. |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2012 04:51 PM |
| So it ends the function no matter what right? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Oct 2012 04:54 PM |
Not necessarily. It depends what you want.
Say you want the function to do a certain, specific task.
function Transparent(part) part.Transparency = 1 end Transparent(game.Workspace.Part)
That doesn't have return in it. It does a certain task by always making Part transparent to 1.
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 30 Oct 2012 04:55 PM |
Whoops, I didn't read it write. Sorry!
I thought you asked something about if you always use return in a function. NVM |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Oct 2012 05:50 PM |
a Huge Thing You would use return for, is going through Lists.
Ok = {"Hi","Bye"}
function check(obj) for i = 1,#Ok do if Ok[i]:lower()==obj.Name:lower() then return true end end return false end
print(check(workspace.Part)) |
|
|
| Report Abuse |
|
|