Bassics
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 415 |
|
|
| 14 May 2014 03:55 PM |
| Is the "and" operator short circuit or long circuit? |
|
|
| Report Abuse |
|
|
Azeroth17
|
  |
| Joined: 13 May 2014 |
| Total Posts: 86 |
|
|
| 14 May 2014 03:59 PM |
| 90% sure it's short circuit. |
|
|
| Report Abuse |
|
|
Bassics
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 415 |
|
|
| 14 May 2014 04:01 PM |
It is short circuit.
I just created a test-code to figure it out for myself:
local x = nil if x and x:IsA("Part") then print("AH") end |
|
|
| Report Abuse |
|
|
Azeroth17
|
  |
| Joined: 13 May 2014 |
| Total Posts: 86 |
|
| |
|
Bassics
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 415 |
|
|
| 14 May 2014 04:17 PM |
| If it was long circuit then the if statement would reach x:IsA("Part"), which would error due to x being nil and not having a className. |
|
|
| Report Abuse |
|
|