Oder gibt es sowas wie
x = if(expr){}in einer Deiner Dir bekannten Programmiersprachen?
Klar, das ist weit verbreitet:
- Ruby:
x = if condition then foo else bar end- Haskell:
x = if condition then foo else bar- Rust:
x = if condition { foo } else { bar }- Python:
x = foo if condition else bar- Elm:
x = if condition then foo else bar- PureScript:
x = if condition then foo else bar- OCaml:
x = if condition then foo else bar- F#:
x = if condition then foo else bar- …
Was Du hier zitierst sind bedingte Zuweisungen, aber deswegen hat if() noch lange keinen Rückgabewert. MfG