| 1 |
|
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>IF Metacommand in Embperl</title> |
| 5 |
</head> |
| 6 |
|
| 7 |
<body> |
| 8 |
|
| 9 |
[- $a = 1; $b = 0; $c = 5; $d = 'txt' -] |
| 10 |
|
| 11 |
a1 |
| 12 |
[* if ($a) { *] |
| 13 |
a <br> |
| 14 |
[* } *] |
| 15 |
|
| 16 |
a2 |
| 17 |
[* if ( $a) { *] |
| 18 |
a <br> |
| 19 |
[* } else { *] |
| 20 |
not a<br> |
| 21 |
[* } *] |
| 22 |
|
| 23 |
a3 |
| 24 |
[* if ( $a<br>) { *] |
| 25 |
a <br> |
| 26 |
[* } else { <br>*] |
| 27 |
not a<br> |
| 28 |
[* } <br>*] |
| 29 |
|
| 30 |
a4 |
| 31 |
[*<br>if ($a) { *] |
| 32 |
a <br> |
| 33 |
[* <br> } else { <br>*] |
| 34 |
not a<br> |
| 35 |
[* <br>} *] |
| 36 |
|
| 37 |
a5 |
| 38 |
[* if ($a) {*] |
| 39 |
a <br> |
| 40 |
[* if ( $b == 0) {*] |
| 41 |
b is null <br> |
| 42 |
[* } else { *] |
| 43 |
b is not null <br> |
| 44 |
[* } *] |
| 45 |
[* } else{*] |
| 46 |
not a<br> |
| 47 |
[* } *] |
| 48 |
|
| 49 |
|
| 50 |
[* if ($a) {*] |
| 51 |
a <br> |
| 52 |
[* if ( $b == 0) {*] |
| 53 |
b is null <br> |
| 54 |
[* } else { *] |
| 55 |
b is not null <br> |
| 56 |
[* } *] |
| 57 |
[* } else {*] |
| 58 |
not a<br> |
| 59 |
[* if ( $b == 0) {*] |
| 60 |
b is null <br> |
| 61 |
[* } else { *] |
| 62 |
b is not null <br> |
| 63 |
[* } *] |
| 64 |
[* } *] |
| 65 |
|
| 66 |
|
| 67 |
[* if (!$a) {*] |
| 68 |
not a <br> |
| 69 |
[* if ( $b == 0) {*] |
| 70 |
b is null <br> |
| 71 |
[* } else { *] |
| 72 |
b is not null <br> |
| 73 |
[* } *] |
| 74 |
[* } else {*] |
| 75 |
a<br> |
| 76 |
[* if ( $b == 0) {*] |
| 77 |
b is null <br> |
| 78 |
[* } else { *] |
| 79 |
b is not null <br> |
| 80 |
[* } *] |
| 81 |
[* } *] |
| 82 |
|
| 83 |
|
| 84 |
[* if ($a) {*] |
| 85 |
a <br> |
| 86 |
[* if ( $b == 0) {*] |
| 87 |
b is null <br> |
| 88 |
[* } elsif ($c == 5) { *] |
| 89 |
b is not null and c is 5 <br> |
| 90 |
[* } elsif ($d eq 'txt') {*] |
| 91 |
b is not null and c is not 5, but d is 'txt' <br> |
| 92 |
[* } else { *] |
| 93 |
b is not null and c is not 5 and d is not 'txt' <br> |
| 94 |
[* } *] |
| 95 |
[* } else {*] |
| 96 |
not a<br> |
| 97 |
[* } *] |
| 98 |
|
| 99 |
|
| 100 |
[- $ttrue = 'true'; $tfalse = '' -] |
| 101 |
|
| 102 |
[* if ( $ttrue) { *] |
| 103 |
ttrue = true |
| 104 |
[* } else { *] |
| 105 |
ttrue = false |
| 106 |
[* } *] |
| 107 |
|
| 108 |
[* if ( $tfalse) { *] |
| 109 |
tfalse = true |
| 110 |
[* } else { *] |
| 111 |
tfalse = false |
| 112 |
[* } *] |
| 113 |
|
| 114 |
|
| 115 |
</body> |
| 116 |
</html> |
| 117 |
|