There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

nickwitha_k ,

IIRC, a nil value can be checked against a literal successfully but not against another nil value. Say you want to check for equality of two vars that could be nil. You just need an extra if statement to ensure that you are not trying to compare nil and nil or nil and a non-nil value (that’ll give you a type error or NPE):


<span style="color:#323232;">var a *string
</span><span style="color:#323232;">var b *string
</span><span style="color:#323232;">
</span><span style="color:#323232;">...
</span><span style="color:#323232;">if a != nil && b != nil {
</span><span style="color:#323232;">  if a == b {
</span><span style="color:#323232;">    fmt.Println("Party!")
</span><span style="color:#323232;">  } else {
</span><span style="color:#323232;">    fmt.Println("Also Party!")
</span><span style="color:#323232;">}
</span>
  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines