forked from TES3MP/CoreScripts
-
Notifications
You must be signed in to change notification settings - Fork 1
conditionals
HebiKotei edited this page Feb 26, 2023
·
2 revisions
Smart use of the 'or' operator instead of nil checks increases readability.
if name then
return name
else
return "John Doe"
end
return name or "John Doe"
Just use ternary operators to evaluate the expression
if name == "mark" or name == "stacy"
return true
else
return false
end
return name == "mark" or name == "stacy" -- Will return true if name is either mark or stacy