상세 컨텐츠

본문 제목

반복문

취미/생활코딩

by 민트색구름 2017. 10. 10. 12:23

본문

반응형

조건문이 똑똑한 작업을 처리했다면

반복문은>> 반복적인 작업을 통해 많은 일을 처리하는게 가능하게 해줌..

while(true/false){

}

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>



반응형

관련글 더보기