Quantcast
Channel: ループタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 92

PHPのwhileでループ処理を行いましょう☆

$
0
0
whileを使って条件が満たされている間、 繰返しができるループ処理をしていきましょう! 50点を持っていて、-10ずつ減らしていきます。 index.php <?php $score = 50; while ($score > 0) { echo "あなたの点数は $score です!" . PHP_EOL; $score -= 10; } ターミナルに以下を入力します! ~$ php index.php このように出力されます! ~ $ php index.php あなたの点数は 50 です! // -10ずつ減っていきます あなたの点数は 40 です! あなたの点数は 30 です! あなたの点数は 20 です! あなたの点数は 10 です! ~ $

Viewing all articles
Browse latest Browse all 92

Trending Articles