Ternary conditional operator: Difference between revisions

Content deleted Content added
mNo edit summary
Add entry and example for the V language
Line 925:
<syntaxhighlight lang="c">
Locals.UUTIndex = ( RunState.Root.Parameters.TestSocket.Index == 3 ? 3 : 0 )
</syntaxhighlight>
 
===V (Vlang)===
[[V (programming language)|V]] uses ''if expressions'' instead of a ternary conditional operator:<ref>{{Cite web |title=V language documentation |url=https://github.com/vlang/v/blob/master/doc/docs.md#if-expressions |access-date=2025-04-01|website=github}}</ref>
<syntaxhighlight lang="c">
num := 777
var := if num % 2 == 0 { "even" } else { "odd" }
println(var)
</syntaxhighlight>