Ternary conditional operator: Difference between revisions

Content deleted Content added
m Lua: why is the section param disabled in this template?
Line 504:
</syntaxhighlight>
 
Luau, a dialect of Lua, has ternary expressions that look like if statements, but unlike them, they have no {{code|lang=lua|end}} keyword, and the {{code|lang=lua|else}} clause is required. One may optionally add {{code|lang=lua|elseif}} clauses. It's designed to replace the {{code|lang=lua|cond and a or b}} idiom and is expected to work properly in all cases.<ref>{{Cite web |title=Syntax § If-then-else expressions|url=https://luau-lang.org/syntax#if-then-else-expressions |access-date=2023-02-07 |website=Luau |language=en}}</ref>
 
<syntaxhighlight lang="lua">