You could use `?:` for the assignment and extract ...
# getting-started
a
You could use
?:
for the assignment and extract the stuff within the if to a method or something Or something like
Copy code
secStepPayServiceFragment = getSupportFragmentManager().findFragmentByTag("second") as? SecStepPayServiceFragment ?: SecStepPayServiceFragment.newInstance(debt.toString(),"").also {
            fragmentTransaction.replace(R.id.fragment_container, it, "second")
            fragmentTransaction.addToBackStack("second")
            fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
            fragmentTransaction.commit()
        }
But that's maybe a bit less clear
👍 2