Skip to content

Instantly share code, notes, and snippets.

@rock3r
Created January 8, 2019 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rock3r/2918eab9d0bbb8aaa26a479a367770c1 to your computer and use it in GitHub Desktop.
Save rock3r/2918eab9d0bbb8aaa26a479a367770c1 to your computer and use it in GitHub Desktop.
package me.seebrock3r.util
/**
* Calls the specified function [block] as a side effect of a previous expression.
*
* This is similar to [run] in that it's used to chain side effects, but it
* doesn't return anything and the block doesn't have any parameters. If your
* side effects require either of those things, use [run] or [also] instead.
*
* @see run
* @see also
*/
@Suppress("unused") // We don't really need the Any receiver but we want to keep fluency
inline fun Any.andThen(block: () -> Unit) {
block()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment