´¹¤åºK

¹q¸£¤­°ê»y¨¥°ò¦3: ¦pªG «h §_«h IF Then Else

µ¹´¹·s»D¤@­ÓÆg




(®L»F¼Ý »s¹Ï)

§@ªÌ¡G®L»F¼Ý 2010-12-16 ªìª©

­n®Ú¾Ú¤£¦Pª¬ªp
¥s¹q¸£°µ¤£¦Pªº¨Æ
´N­n¥Î IF §PÂ_
¦pªG "If  §PÂ_¦¡ Then" §PÂ_¦¡¥¿½T
¨º´N·|©¹¤U°õ¦æ
§_«h
´N·|§ä¤U­Ó "ElseIf ...Then" Ä~Äò§PÂ_
¦pªGÁÙ¬O¤£¹ï
¨º´N¥u¦n°õ¦æ "Else" ¥H«áªº«ü¥O¤F
¦pªG¨S¦³ "Else"
¨º´N·|°õ¦æ End If ¥H«áªº«ü¥O
BASIC¤§¥~ªº»y¨¥
·|¥Î "{...}" §â¤@¦ê«ü¥O¥]¦¨¤@²Õ
¦pªG­n°õ¦æªº¸Ü ´N°õ¦æ³o¤@¾ã²Õ«ü¥O

BASIC:
        ' *******************************************
        ' Condition statement (If..ElseIf..Else..End If)
        ' *******************************************
        Sub IfStatement()
            Dim dPara1 as Double
            Dim dPara2 as Double
            dPara1 = 1.0
            dPara2 = 2.0
            ' Condition statement (If..ElseIf..Else..End If)
            If dPara1 > dPara2 Then
                ' Is Greater Than
                Debug.Print " ";"dPara1 > dPara2";
                Debug.Print
            ElseIf dPara1  = dPara2 Then
                ' Equals to
                Debug.Print " ";"dPara1 ==dPara2";
                Debug.Print
            ElseIf dPara1 < dPara2 Then
                ' Is Less Than
                Debug.Print " ";"dPara1 < dPara2";
                Debug.Print
            End If
            If dPara1 <> dPara2 Then
                ' not equal to
                Debug.Print " ";"dPara1 <> dPara2";
                Debug.Print
            End If
            ' And Logic
            If dPara1 > dPara2 AND dPara1  = dPara2 Then
                Debug.Print " ";"dPara1 >=dPara2";
                Debug.Print
            ' Or Logic
            ElseIf dPara1 > dPara2 OR dPara1 < dPara2 Then
                Debug.Print " ";"dPara1 <> dPara2";
                Debug.Print
            End If
        End Sub
 

C++:
        /* ******************************************* */
        /* Condition statement (If..ElseIf..Else..End If) */
        /* ******************************************* */
        void IfStatement() {
            double dPara1;
            double dPara2;
            dPara1 = 1.0;
            dPara2 = 2.0;
            /* Condition statement (If..ElseIf..Else..End If) */
            if (dPara1 > dPara2) {
                /* Is Greater Than */
                printf(" %s" , "dPara1 > dPara2");
                printf("\n\r" );
            } else if (dPara1 ==dPara2) {
                /* Equals to */
                printf(" %s" , "dPara1 ==dPara2");
                printf("\n\r" );
            } else if (dPara1 < dPara2) {
                /* Is Less Than */
                printf(" %s" , "dPara1 < dPara2");
                printf("\n\r" );
            }
            if (dPara1 != dPara2) {
                /* not equal to */
                printf(" %s" , "dPara1 <> dPara2");
                printf("\n\r" );
            }
            /* And Logic */
            if (dPara1 > dPara2 && dPara1 ==dPara2) {
                printf(" %s" , "dPara1 >=dPara2");
                printf("\n\r" );
            /* Or Logic */
            } else if (dPara1 > dPara2 || dPara1 < dPara2) {
                printf(" %s" , "dPara1 <> dPara2");
                printf("\n\r" );
            }
        }

JAVA:   
        // *******************************************
        // Condition statement (If..ElseIf..Else..End If)
        // *******************************************
        public void IfStatement()  {
            double dPara1;
            double dPara2;
            dPara1 = 1.0;
            dPara2 = 2.0;
            // Condition statement (If..ElseIf..Else..End If)
            if (dPara1 > dPara2) {
                // Is Greater Than
                System.out.print(" "+"dPara1 > dPara2" );
                System.out.println("");
            } else if (dPara1 ==dPara2) {
                // Equals to
                System.out.print(" "+"dPara1 ==dPara2" );
                System.out.println("");
            } else if (dPara1 < dPara2) {
                // Is Less Than
                System.out.print(" "+"dPara1 < dPara2" );
                System.out.println("");
            }
            if (dPara1 != dPara2) {
                // not equal to
                System.out.print(" "+"dPara1 <> dPara2" );
                System.out.println("");
            }
            // And Logic
            if (dPara1 > dPara2 && dPara1 ==dPara2) {
                System.out.print(" "+"dPara1 >=dPara2" );
                System.out.println("");
            // Or Logic
            } else if (dPara1 > dPara2 || dPara1 < dPara2) {
                System.out.print(" "+"dPara1 <> dPara2" );
                System.out.println("");
            }
        }
   

C#:
        /* ******************************************* */
        /* Condition statement (If..ElseIf..Else..End If) */
        /* ******************************************* */
        public void IfStatement()  {
            double dPara1;
            double dPara2;
            dPara1 = 1.0;
            dPara2 = 2.0;
            /* Condition statement (If..ElseIf..Else..End If) */
            if (dPara1 > dPara2) {
                /* Is Greater Than */
                Console.Write(" "+"dPara1 > dPara2");
                Console.WriteLine("");
            } else if (dPara1 ==dPara2) {
                /* Equals to */
                Console.Write(" "+"dPara1 ==dPara2");
                Console.WriteLine("");
            } else if (dPara1 < dPara2) {
                /* Is Less Than */
                Console.Write(" "+"dPara1 < dPara2");
                Console.WriteLine("");
            }
            if (dPara1 != dPara2) {
                /* not equal to */
                Console.Write(" "+"dPara1 <> dPara2");
                Console.WriteLine("");
            }
            /* And Logic */
            if (dPara1 > dPara2 && dPara1 ==dPara2) {
                Console.Write(" "+"dPara1 >=dPara2");
                Console.WriteLine("");
            /* Or Logic */
            } else if (dPara1 > dPara2 || dPara1 < dPara2) {
                Console.Write(" "+"dPara1 <> dPara2");
                Console.WriteLine("");
            }
        }


PHP:   
        /* ******************************************* */
        /* Condition statement (If..ElseIf..Else..End If) */
        /* ******************************************* */
        function IfStatement()  {
            $dPara1 = 1.0;
            $dPara2 = 2.0;
            /* Condition statement (If..ElseIf..Else..End If) */
            if ($dPara1 > $dPara2) {
                /* Is Greater Than */
                echo " "."dPara1 > dPara2";
                echo "";
            } elseif ($dPara1 ==$dPara2) {
                /* Equals to */
                echo " "."dPara1 ==dPara2";
                echo "";
            } elseif ($dPara1 < $dPara2) {
                /* Is Less Than */
                echo " "."dPara1 < dPara2";
                echo "";
            }
            if ($dPara1 != $dPara2) {
                /* not equal to */
                echo " "."dPara1 <> dPara2";
                echo "";
            }
            /* And Logic */
            if ($dPara1 > $dPara2 && $dPara1 ==$dPara2) {
                echo " "."dPara1 >=dPara2";
                echo "";
            /* Or Logic */
            } elseif ($dPara1 > $dPara2 || $dPara1 < $dPara2) {
                echo " "."dPara1 <> dPara2";
                echo "";
            }
        }