Last active
July 17, 2018 14:25
-
-
Save luangs7/cc26412335c949c467f2c7294be66037 to your computer and use it in GitHub Desktop.
Revisions
-
luangs7 revised this gist
Jul 17, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ inline infix fun EditText.guard(call: () -> Unit): String? { if (this.text.isNotEmpty()) return text else { call() return null -
luangs7 revised this gist
Jul 17, 2018 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,6 @@ inline infix fun EditText.guard(call: () -> Unit): String? { call() return null } } @@ -14,5 +13,4 @@ val name = field.guard{ println("This field cant be empty!") return null } println($name) -
luangs7 created this gist
Jun 18, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ inline infix fun EditText.guard(call: () -> Unit): String? { if (!this.text.isNotEmpty()) return text else { call() return null } } //example of usage val name = field.guard{ println("This field cant be empty!") return null } println($name)