Tag: nested

Stop using nested ifs. Do this instead

A typical use case for nested ifs: you want to perform all sorts of checks on some data to make sure it’s valid before finally doing something useful with it. Don’t do this! : // JavaScript function sendMoney(account, amount) { if (account.balance > amount) { if (am...

Stop using nested ifs. Do this instead

A typical use case for nested ifs: you want to perform all sorts of checks on some data to make sure it’s valid before finally doing something useful with it. Don’t do this! : // JavaScript function sendMoney(account, amount) { if (account.balance > amount) { if (am...

Bottom Navigation Bar with nested Scaffolds

On the Android developer documentation there is a guide on how to integrate the bottom navigation bar into your app, which uses a top level Scaffold and a NavHost as its content. The problem The issue I encountered with this setup is the fact that it’s hard to ne...

Stop using nested ifs. Do this instead

A typical use case for nested ifs: you want to perform all sorts of checks on some data to make sure it’s valid before finally doing something useful with it. Don’t do this! : // JavaScript function sendMoney(account, amount) { if (account.balance > amount) { if (am...