Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by matheusmoreira

20 hours ago

> The classic Lua idiom a and b or c has a pitfall when b is nil or false: then c is returned, even when a is truthy.

> E.g. true and false or 42 returns 42, whereas true ? false : 42 returns the (expected) false.

0 comments

matheusmoreira

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities