Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wish they showed the `else` syntax, because the traditional ALGOL-style if-then-else statement doesn't look native when shoved into most function call notations, unless you have something pretty interesting around named parameters and expressions delimiters.


See the `either` function further down

  either some-condition { print "was true" } { print "was false" }


there is no if { } else { } in REBOL or Rye and it wouldn't really fit. There is either function that accepts two code blocks. It can act as a typical if / else or as a ternary expression as it also returns the result of a block:

    print either pwd = "correct" { "Hello" } { "Locked" }
This is Rebol's doc on either, Rye's works exactly the same: https://www.rebol.com/docs/words/weither.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: