|
| 30 Jan 2012 03:04 PM |
Consider the following code:
function test(x,y) if x > y then return true else return false end end
val1 = 25 val2 = 17
test(val1,val2)
Well, that's one way of accomplishing it, but here's another:
function test(x,y) return x > y end
val1 = 25 val2 = 17
test(val1,val2)
I hope this helped. |
|
|
| Report Abuse |
|
|
Cyrok
|
  |
| Joined: 11 Jan 2012 |
| Total Posts: 630 |
|
|
| 30 Jan 2012 03:10 PM |
i dun understand
explain whole thing
{ Learning normal Lua and RBX.Lua. } |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2012 03:15 PM |
function test(x,y) if x > y then -- If the statement 'x > y' is true return true -- return true else -- If the statement 'x > y' is false return false -- return false end end
val1 = 25 val2 = 17
test(val1,val2)
The code below does the same exact thing, except in a more efficient way:
function test(x,y) return x > y --This returns either 'true' or 'false', it does the same thing as the ---above function end
val1 = 25 val2 = 17
test(val1,val2)
|
|
|
| Report Abuse |
|
|
Cyrok
|
  |
| Joined: 11 Jan 2012 |
| Total Posts: 630 |
|
|
| 30 Jan 2012 03:19 PM |
explain everything over again
i cant seem to get it
{ Learning normal Lua and RBX.Lua. } |
|
|
| Report Abuse |
|
|