Create Functions With Logical Conditions