New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

What's the name of this variable setting method?

Asked by
RAFA1608 195
9 days ago

I wanted to learn more about this, but i dont know the name.

local hum = part.Parent:FindFirstChildWhichIsA("Humanoid") or part.Parent.Parent:FindFirstChildWhichIsA("Humanoid")

Thank you for your help.

0
As an addition if you really want to know the name of this assignment method. To be honest I don't think there really is one. The closest you could compare it to is a ternary (conditional) operation. FloweryMonkeyboy5 984 — 9d

1 answer

Log in to vote
1
Answered by 9 days ago

In it's basis what this does is check if the value before the or is a truthy value (anything but nil). That means if there's no child which is a Humanoid then it will return nil. Additionally if the value before or is not a truthy value then it will use the value behind or.

0
That's not exactly what i asked for, but thank you. RAFA1608 195 — 9d
Ad

Answer this question