http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14641

--- Comment #7 from Jonathan Druart <[email protected]> 
---
The verbose way to do it is:

    my ($selected_lettercode) = @_;
    if ( not defined $selected_lettercode ) {
        $selected_lettercode = '';
    }

A better way, IMO is to use `unless` instead of `if not`

    my ($selected_lettercode) = @_;
    unless ( defined $selected_lettercode ) {
        $selected_lettercode = '';
    }

A much more better way is to do the same but more readable (because less
verbose):

    my ($selected_lettercode) = @_;
    $selected_lettercode //= '';

`//=` means `assign what is at the right if what is at the left is not defined`

`||=` would means `assign what is at the right if what is at the left is not
defined or is 0 or is an empty string`

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to