3 ms·
let post = Post.findByID(1) if post != nil { return post.title } else { return nil } Or, as a cool C-like would put it: let post =
by FeepingCreature 11y ago
let post = Post.findByID(1)
if post != nil {
return post.title
} else {
return nil
}
Or, as a cool C-like would put it:
let post = Post.findByID(1)
return post?.title
Just saying!
- octocoupler 11y agoThat is how it's done in Swift. Are you saying there are C languages that do the same thing?
- FeepingCreature 11y agoWell, mine does ( https://github.com/FeepingCreature/fcc https://github.com/FeepingCreature/fcc ). I don't think it's very widespread, sadly. Example: https://github.com/FeepingCreature/fcc/blob/master/tests/test69.nt https://github.com/FeepingCreature/fcc/blob/master/tests/tes...
- octocoupler 11y agoNice! If you want it to be, you should add some information and examples. Or a simple website, even.
- FeepingCreature 11y agoNo I mean the syntax. :) For my language, I'll do some proper advertising on it once I figure out version two; v1 is very much a testbed for playing around with language design.