Chapter 11 - What means "_ ="

From this code :

 let user = User(
    name: expectedName,
    username: expectedUsername)
  let savedUser = try user.save(on: conn).wait()
  _ = try User(
    name: "Luke",
    username: "lukes").save(on: conn).wait()

I’m not sure about what the “_ =” means ?

_ is a way in Swift of telling the compiler I know that this expression returns something but ignore it. Without it, you’d get a warning. Hope that helps!

1 Like