Last active
October 19, 2016 07:11
Part of IF inversion examples, contains only the tangled version of the function
This file contains 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 characters
<?php | |
function validateApplicationTangled($user) { | |
if($user->age>18) { | |
if(($user->hasPreviousApplication && !$user->previousApplicationApproved) || !$user->hasPreviousApplication) { | |
printf("Cool, application approved for user %s\n", $user->name); | |
return true; | |
} else { | |
printf("Sorry, but the user %s has a previously approved application\n", $user->name); | |
return false; | |
} | |
} else { | |
printf("Sorry, but the user %s is under 18\n", $user->name); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment