NTEmacsใฎ่จญๅฎใใใพใใงใใชใใฆๆญๅฟตใใใใใใฐใใฏugnewsใงใใ
ไปๆฅใฏใใญใฐใฉใใณใฐใซใฏๆฌ ใใใชใ๏ผ๏ผ๏ผใใใifๆใๅญฆใใ ใใ
ifใฃใฆใฎใฏใใใใใใใชใใจใใชใใฐใใใจใใๆ็ซ ใใใญใฐใฉใ ใง่กจ็พใงใใใ
ใพใๆๅใซใๆฐๅญใ7ใใใๅคงใใใฃใใใใใฏใใใใๅ
ใกใใโชใใจ่กจ็คบใใใใญใฐใฉใ ใๆธใใฆใฟใใ
my $number = "7"; if ($number < 8) { print "1ใใฏใใใใๅ ใกใใโช\n"; } if ($number < 7) { print "2ใใฏใใใใๅ ใกใใโช\n"; }
ใใใๅฎ่กใใใจใ
1ใใฏใใใใๅ ใกใใโช
ใฃใฆใชใใใใฎใณใผใใฎไธญใซใใ ($number < 8) ใฃใฆใฎใฏใชใซใใ$numberใซใฏ7ใฃใฆใฎใๅ ฅใฃใฆใใใคใพใ (7 < 8) ใฃใฆใใจใงใใใฎๅ ดๅใฏ$numberใ8ใใๅฐใใใชใ็ใใใไปฅๅคใชใๅฝใจใใใใจใซใชใใใ ใใใใใฎๆกไปถใใฏใชใขใใฆใใใ1ใใฏใใใใๅ ใกใใโชใใๅฎ่ก็ตๆใจใใฆ่กจ็คบใใใใใใ้ใซใใ2ใใฏใใใใๅ ใกใใโชใใ่กจ็คบใใใชใ็็ฑใฏใ$numberใ7ใจๅใๅคงใใใ ใใใใพใผใใใฏไฝๅใๆธใใฆใฆใใใใ็่งฃใใใ
ใใใใๆง้ ใใใฆใใ
if (ๆกไปถๅผ ) {
ๆกไปถๅผใ็ใฎใจใใฎๅฆ็
}
้ใซใใฆใฟใใใใ
my $number2 = "7"; if ($number2 > 6) { print "3ใใฏใใใใๅ ใกใใโช\n"; } if ($number2 > 7) { print "4ใใฏใใใใๅ ใกใใโช\n"; }
ๅฎ่กใใใจใ
3ใใฏใใใใๅ ใกใใโช
ใซใชใใ($number2 > 6) ใฃใฆใฎใฏ$number2ใ6ใใๅคงใใใจ็ใใใไปฅๅคใชใๅฝใจใชใๆกไปถๅผใใ4ใใฏใใใใๅ ใกใใโชใใ่กจ็คบใใใชใ็็ฑใฏใพใใใใ ใใ
ใกใชใฟใซใ{}ใฎไธญใซใฏใใใคใงใๆ็ซ ใๆธใใใ
if ($number < 8) { print "ใใฏใใใใๅ ใกใใโช\n"; print "ใใใใฎๅนดใฏ$numberใ ใใ\n"; print "ๆช้ญไธป็พฉ่ ใฏไฝใใ่ฟฝๅใใๅฒๅญฆ่ ใ ใจ่จใใใ\n" }
ๅฎ่กใใฆใฟใใ
ใใฏใใใใๅ ใกใใโช
ใใใใฎๅนดใฏ7ใ ใใ
ๆช้ญไธป็พฉ่ ใฏไฝใใ่ฟฝๅใใๅฒๅญฆ่ ใ ใจ่จใใใ
ไปใใใใใๆธใใฆใใใฎใฏifๆใฃใฆใใใใใฎไปใซใใifไฟฎ้ฃพๅญใใฃใฆใฎใใใใ
ใใใifๆใ
my $if = "1"; if ($if == 1) { print "ใใฏใใใๆญปใฌ\n"; }
ใใใifไฟฎ้ฃพๅญใ
my $if = "1"; print "ใใฏใใใๆญปใฌ\n" if ($if == 1);
่ฆใ็ฎใฏใกใใฃใจ้ใใใฉใๅฎ่ก็ตๆใฏใฉใกใใ
ใใฏใใใๆญปใฌ
ใซใชใใใคใพใใๅไฝใใฎใใฎใซๅทฎใฏใชใใฆใๅ็ดใซใไบบ้ใใ่ชญใฟใใใใฎๅทฎใใงใใ ใใโฆใฎใฏใใชใใ ใใฉใไฝฟใๆนใซใใฃใฆใฏifๆใฎๆนใๅชใใฆใใใจใใใใฑใผในใใใใใ ใใฉใๆธใใฎใฏ็็ฅใ
ใกใชใฟใซใใใฎๆกไปถๅผ ($if == 1) ใฏใฉใใใๆๅณใใจใใใจใ (1 == 1) ใฃใฆใชๆใใงใๅใๆฐใฎๅ ดๅใฎใฟใใใฏใใใๆญปใฌใใจใใๆๅญใ่กจ็คบใใใใใใซใใฆใใใงใใญใ
ๆฌกใฏif-elseๆใใใใไฝฟใใจใๆกไปถๅผใ็ใซใชใใจใใจๅฝใซใชใใจใใจใง้ใฃใๅฎ่ก็ตๆใๅบใใฆใใใใ
my $hour = "7"; if ($hour < 8) { # ใใฎ1 print "ใใฏใใใ\n"; print "ไปใฏ", "$hour", "ๆใ โฆใ\n\n"; } else { print "ใใใซใกใฏใ\n"; print "ๆช้ญใฎๅ็ใใใๅฏไธใฎ็ต็็นใ ใ\n\n"; } if ($hour < 6) { # ใใฎ2 print "ใใฉใใฏใปใกใฟใซใฏ็ฝไบบใฎใใใฎใใฎใ โฆใ\n\n"; } else { print "ใญใชในใๆใฏๆๅใในใๅฎๆใ โฆใ\n\n" }
ใใใๅฎ่กใใใจใ
ใใฏใใใ
ไปใฏ7ๆใ โฆใใญใชในใๆใฏๆๅใในใๅฎๆใ โฆใ
ใฃใฆๅบใใใใใฎ1ใใฏใใพใ$hourใฎๅคใ8ใใๅฐใใใใ(ใใใ็)ใใใใฏใใใไปใฏ7ๆใ โฆใใใจๅฎ่ก็ตๆใๅบใใ
ใใใฎ2ใใฏใ$hourใฎๅคใ6ใใๅคงใใใใ(ใคใพใๅฝ)ใใใใฉใใฏใปใกใฟใซใฏ็ฝไบบใฎใใใฎใใฎใ โฆใใใๅฎ่ก็ตๆใจใใฆ่กจ็คบใใใใใใ็ๆนใฎใใญใชในใๆใฏๆๅใในใๅฎๆใ โฆใใใ่กจ็คบใใใใใใใใฆelseใๆธใใฆใใใจใๅฟ ใใฉใกใใใๅฆ็ใใใใใ ใใผใ
ใใผใๅ ฑ้ใชๅฆ็ใฏif-elseใฎๅคใซๅบใใฆใใใใปใใใใใใใ
my $unko = "5"; if ($unko < 6) { print "ๆญปใซใฆใผ(็ฌ)\n"; } else { print "็ฒพ็ฅใๅดฉๅฃใใ\n"; } print "ไปใฏ", "$unko", "ๆใงใใ\n\n";
ใๆญปใซใฆใผ(็ฌ)ใใจใ็ฒพ็ฅใๅดฉๅฃใใใใฏใฉใกใใใใ่กจ็คบใใใชใใใฉใ
ๆญปใซใฆใผ(็ฌ)
ไปใฏ5ๆใงใใ
ใฎใไปใฏ5ๆใงใใใใฏใฉใฃใกใฎๅฆ็ใงใๅบใใฎใงใใใใใฃใฆๆธใใใจใใงใใใใใ ใ
ๆฌกใฏใif-else-elsifๆใif-elseๆใ ใจใ2ใคใฎๅฆ็ใใ1ใคใ้ธใถใฃใฆใฎใ ใฃใใใฉใ่คๆฐใฎๅฆ็ใใ1ใคใ้ธในใใฎใใใฎif-else-elsifๆใ ใ
my $hour = "1"; if ($hour < 8) { print "ใใฏใใใใฒ\n"; } elsif ($hour < 12) { print "ใใใซใกใฏใใฒ\n"; } elsif ($hour == 12) { print "่ นๆธใฃใใใฒ\n"; } elsif ($hour < 17) { print "ใใใใซใกใฏใใฒ\n"; } else { # ใใไปฅๅค print "ๆญปใซใฆใ\n"; } print "ไปใฎๆ้ใฏ", "$hour", "ใงใใ\n\n";
ๅฎ่กใใใจ
ใใฏใใใใฒ
ไปใฎๆ้ใฏ1ใงใใ
ๅฎ่ก็ตๆใใใณใชๆฅๆฌใงๅบใฆใใใใฉใใใใงๅใฃใฆใพใใ$hourใฎๅคใ11ใซใใใจใใใใซใกใฏใใฒใใฃใฆๅบใใใๅคใ12ใซใใใฐใ่ นๆธใฃใใใฒใใซใชใใ17ไปฅไธใฎๅคใซใใใจใelseใฎไธญใซๅ ฅใฃใฆใใๆญปใซใฆใใใ่กจ็คบใใใใ
ifๆใฃใฆ้ข็ฝใใญใใจใใใใใฃใจใใญใฐใฉใใณใฐใใใฃใฆใใฃใฆๆฐใซใชใฃใฆใใใใใใใจใงใใญใ
ใๆผ็ฎๅญandใ
andใไฝฟใใจใ่คๆฐใฎๆกไปถใใพใจใใฆใใใคใใ่กจ็พใงใใใ
my $sperma = "14"; if (9 <= $sperma and $sperma <= 17) { print "ใใไฟบใฎใฉใคใใใคใณใใฏใผใญใ "; }
ๅฎ่กใใใพใงใใชใใใฉใ
ใใไฟบใฎใฉใคใใใคใณใใฏใผใญใ
9ไปฅไธใใค17ไปฅไธใฎใจใใซprintใซๅ ฅใฃใฆใใคใใ่กจ็คบใใใ
ใๆผ็ฎๅญorใ
orใไฝฟใใจใ่คๆฐใฎๆกไปถใใพใจใใฆใใพใใฏใใ่กจ็พใงใใใ
my $slayer = "5"; # ใใฎ1 if ($slayer == 5 or $slayer == 8) { print "My life is ็ณ"; } print "\n"; my $unko = "11"; # ใใฎ2 if ($unko == 12 or $unko == 15) { print "่ นใๆธใฃใฆๆญปใฌ"; } else { print "ใใใ ใกใฟใชใซ"; }
ๅฎ่กใใใจใ
My life is ็ณ
ใใใ ใกใฟใชใซ
ใใใฎ1ใใฎๅ ดๅใๅคๆฐใฎๅคใ5ใใพใใฏ8ใงใใๅ ดๅใซใใMy life is ็ณใใจ่กจ็คบใใใใใใใฎ2ใใใใใฃใฆelseใใใกใใไฝฟใใใใชใผใจๆฌใซๆธใใฆใชใใใฉๅใงใใฃใใใใฃใใๅบๆฅใใใใใใฃใฆ่ชๅใใใใใใใใใฎใฏๅคงไบใงใใญใใใฎๆกไปถๅผใฏๅฝใซใชใใฎใงใใใใ ใกใฟใชใซใใ่กจ็คบใใใใ
ifๆใงใกใใฃใจใใใใฎใงใไฝใฃใฆใฟใใ
ใใใฏใใฆใผใถใๅ ฅๅใใๆฐใซๅฟใใใกใใปใผใธ่กจ็คบใใใใใญใฐใฉใ ใ่ชๅ่ฒฉๅฃฒๆฉ้ขจๅณใ
print "้ฃฒใฟ็ฉใ้ธใน\n"; print "1 = ใฌใใใใซ\n"; print "2 = ใฉใผใกใณไบ้๏ผ ๅๅทๅบใฎในใผใ\n"; print "3 = ใใใฏในใณใผใใผ\n"; my $line = <STDIN>; if ($line == 1) { print "ใฌใใใใซ\n"; } elsif ($line == 2) { print "ใฉใผใกใณไบ้๏ผ ๅๅทๅบใฎในใผใ\n"; } elsif ($line == 3) { print "ใใใฏในใณใผใใผ\n"; } else { print "ไฝใใญใผใ\n"; exit; # ใใญใฐใฉใ ใ็ตไบใใใ }
ๅฎ่กใใใจใ
้ฃฒใฟ็ฉใ้ธใน
1 = ใฌใใใใซ
2 = ใฉใผใกใณไบ้๏ผ ๅๅทๅบใฎในใผใ
3 = ใใใฏในใณใผใใผ
1
ใฌใใใใซ
ใจใ
้ฃฒใฟ็ฉใ้ธใน
1 = ใฌใใใใซ
2 = ใฉใผใกใณไบ้๏ผ ๅๅทๅบใฎในใผใ
3 = ใใใฏในใณใผใใผ
2
ใฉใผใกใณไบ้๏ผ ๅๅทๅบใฎในใผใ
ใฃใฆใชๆใใงใ่ชๅใงๅ ฅๅใใๆฐๅญใซๅฟใใฆ่กจ็คบใใใใ
ใใใงๆธใใใฆใ my $line =
ใใไธใคใ้ใฃใไพใใใใใฏๆญฃใใ็ชๅทใๅ ฅๅใใใ่คใใใใใจใใใฏใบโใใญใฐใฉใ ใงใใ
print "ๆ่จผ็ชๅทใๅ ฅใใฆใญโ"; my $line = <STDIN>; chomp($line); # ๆน่กใๅใ้คใ if ($line eq "0123") { # ๆญฃใใๆ่จผ็ชๅทใ print "ใฏใผใซใช็ชๅทใ ใ\n"; # ๆญฃใใใจใใใชใ } else { print "ใใฎ็ชๅทใฏใฒใคใ ใใ\n"; # ้ใใจใใใชใ }
ๆญฃใใ็ชๅทใๅ ฅๅใใใจใ
ๆ่จผ็ชๅทใๅ ฅใใฆใญโ0123
ใฏใผใซใช็ชๅทใ ใ
ใฃใฆๅบใใใ้ใฃใ็ชๅทใๅ ฅใใใจใ
ๆ่จผ็ชๅทใๅ ฅใใฆใญโ0000
ใใฎ็ชๅทใฏใฒใคใ ใใ
ใจๅบใใ
ใใฎ chomp($line); ใฏใใใๆธใใฆใใใใฉใๅคๆฐ$lineใฎๆๅพใฎๆน่กใๅใ้คใใใจใใๆๅณใใใใ
ใงใๆญฃใใ็ชๅทใใฉใใใฎๅคๆญใฏ $line eq "0123" ใจใใๆกไปถๅผใงใใฃใฆใใใใฎ eq ใฃใฆใฎใฏใไธก่พบใๆๅญๅใจใใฆๆฏ่ผใใ็ญใใใฃใใ็ใซใชใใจใใๆผ็ฎๅญใใพใ == ใจไผผใฆใใใกใชใฟใซใใใฎๅ ดๅใ ใจ == ใงใใกใใใจๅใ็ตๆใซใชใใใ ใใฉใใใใใพใๅพฎๅฆใซ้ใใใใใ
ใชใใฑใใunlessๆใซใคใใฆใ
ifๆใฏใใใใใใชใใจใใชใใฐใใใจใใใฎใ่กจ็พใใใคใใ ใฃใใใฉใunlessๆใฏใใใใใใใใชใใฃใใใใ่กจ็พใงใใใ
ใพใใใใชๆใใงใใ
my $money = "12"; unless ($money < 12) { print "ใใใใใๆผใใใญใผใ\n"; }
ใใใๅฎ่กใใใจใ
ใใใใใๆผใใใญใผใ
ใใผใชใใใฉใใใฆใใใชใใใฏๆ่ฆใงๅใใใใ ใใฉใใใพใ่จ่ชๅใงใใชใใฎใงใในใใใใใใใกใ โฆใ
ใใใ้ทใใชใฃใฆใใพใฃใใใฉใifๆใฎๅๅผทใฏใใฎใใใใงใ
ๅใใไบบใฏ่ชญใใงใฆใใฏใใฏใใพใใใ ใจๆใใใฉใใใฃใใ้้ใฃใฆใใจใใใใใใใใใคใใไปๆฅๅญฆใใ ใใจใ่ชญ่ ๅใใซ่งฃ่ชฌใใในใฟใคใซใๅใฃใฆใๆ็นใงใพใใ ใชใใใใใ ใใฉใใพใใใ ๆธใใใณใผใใจๅฎ่ก็ตๆใๅผตใใ ใใงใใคใพใใใใชใใใใใซใใใใใฆ่งฃ่ชฌใซใชใฃใฆใชใ่งฃ่ชฌใๆธใใใฎใใใใ็จๅบฆใฏ็่งฃใงใใฆใใจใใ่จผๆใงใใใใใญใใๆญฃ็ดใใใฎใจใณใใชใผๆธใใฎใซใใฐใใใใๆ้ใใใฃใฆใใใ ใใฉใใใใใใใจใฏใใใใใ ใใซใชใฃใฆใชใใฏใ(;ยดะ`)ใพใไฝไบใๆๅใฏๆ้ใใใใใใใ ใใชใๅๅใใซใใฎ่ชฟๅญใงใใใใ