Hacker News new | ask | show | jobs
by lyinsteve 4144 days ago

    let x: String = {
       if 3 == 4 {
          return "Hello"
       } else {
          return "Goodbye"
       }
    }()
Although in this case, I'd just use ternary.

    let x = (3 == 4) ? "Hello" : "Goodbye"