Ternary logic: Difference between revisions
→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)"
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
(→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)") |
||
Line 6,463:
</pre>
=={{header|V (Vlang)}}==
{{trans|AutoHotkey}}
Note:
1) V (Vlang) doesn't have a true "ternary" operator, but unlike in other languages, its "if-else if-else" can be written on a single line.
2) This "trick" can make code more understandable, where a traditional ternary style could be visually confusing.
Line 6,475:
Below is an example of how this would look, which can be compared to traditional ternary usage:
<syntaxhighlight lang="v (vlang)">import math
fn main() {
|