Top 1,000 Features Creators Resources Extensions Blog Explorer CSV Download
GitHub icon

Ternary operators

< >
Example from 1 languages: JavaScript
let i = true ? 1 : 0
Example from 1 languages: C
#include <stdio.h> int main(void) { printf("%d", 1 ? 1 : 0); }
Example from 1 languages: Python
print(1 if 1 else 0)
Example from 1 languages: PHP
<?php echo 1 ? 1 : 0;
Example from 1 languages: Kotlin
// Since if statements are expressions println(if (true) true else false)
Example from 1 languages: C3
int foo = x ? 1 : 0;
Example from 1 languages: Speedie
while printline (1,0)(random[]>0.5)
Example from 1 languages: Wax
(set y (? (= x 0) 1 2))
*

Languages with Ternary operators include JavaScript, C, Python, PHP, Kotlin, C3, Speedie, Wax

*

Languages without Ternary operators include HTML, CSS, JSON, XML, Scroll, Jule, Explorer

*

View all concepts with or missing a hasTernaryOperators measurement

*

Read more about Ternary operators on the web: 1.

View source

- Build the next great programming language About Acknowledgements Part of the World Wide Scroll