Thread Code Verkürzen? (12 answers)
Opened by Froschpopo at 2006-03-02 02:32

Ronnie
 2006-03-02 07:21
#63374 #63374
User since
2003-08-14
2022 Artikel
BenutzerIn
[default_avatar]
Viel schöner wird es nicht:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl

use strict;
use warnings;


sub testZZZx {
my ($day, $month) = @ZZZ;

return 'Steinbock' if $month == 1 and $day < 21;
return 'Wassermann' if $month == 1 and $day >= 21
or $month == 2 and $day < 22; #usw.

return 'FALSE';
}

print testZZZx(11, 1), "\n", testZZZx(23, 1), "\n",
testZZZx(11, 2), "\n", testZZZx(25, 2), "\n";

View full thread Code Verkürzen?