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 metabagel

20 hours ago

OK, or maybe...

  total = calculateOrderTotal(user.order);
  total = total * user.discount;

1 comment

metabagel

Reply

1718627440  17 hours ago

Or:

  total = calculateOrderTotal(user.order);
  total *= user.discount;

or:

  return 
         calculateOrderTotal(user.order)
       * user.discount;

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities