본문 바로가기
Coding/WebApp

반복문

by 그냥그렇듯이 2017. 8. 24.
반응형

모든 저작권은 <생활코딩>의 생산자인 <egoing>님에게 있습니다.

문제시, 비공개로 전환하겠습니다.


<반복문>

 JavaScript

 PHP

 while (true/false) {

}

 while (true /false){

}

<!DOCTYPE html>

<html>

<head>

     <meta charset="utf-8">

</head>

<body>

  <h1>JavaScript</h1>

  <ul>

  <script>

    i = 0;

    while(i < 10){

      document.write("<li>hello world</li>");

      i = i + 1;

    }

  </script>

  </ul>


  <h2>php</h2>

  <ul>

  <?php

    $i = 0;

    while($i < 10){

      echo "<li>hello world</li>";

      $i = $i + 1;

    }

  ?>

  </ul>

</body>

</html> 

 


무한 루프 조심


댓글