3 ms·
For example, you might have tried writing something like this: foo = if (x < y) { ... ... } Doesn't work because statements don't yield values.
by amadeuspagel 4y ago
For example, you might have tried writing something like this:
foo = if (x < y) {
...
...
}
Doesn't work because statements don't yield values.
- Akronymus 4y agoThats one of the reason why I REALLY like languages where everything is an expression. let foo = if x < y somevalue else someothervalue in f# for example.
- bern4444 4y agoI also love F#. One of the most interesting languages that I've ever seen. This is certainly another great aspect of it.
- bern4444 4y agoSo are ternaries expressions then too? const x = x < y ? 2 : 3;
- amadeuspagel 4y agoYes, indeed.