|
|
|
|
|
by wantreprenr007
3773 days ago
|
|
This article is timely for us as we're using Scala for backend work. Ruby 2.3 &. operator and Swift can do something like this pseudocode: if let city = article?.author?.address?.city?.ToLower() {
// city present
}
Too long?: if let city = article?
.author?
.address?
.city?
.ToLower() {
// city present
}
All are improvements over pyramids of doom.(Be aware of subtle gotcha in Scala of var and val, really prefer Rust/Go/Swift keywords.) |
|