Created
November 9, 2012 09:18
-
-
Save samikeijonen/4044704 to your computer and use it in GitHub Desktop.
Sami keijonen: Tehtävä 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Silmukat</title> | |
</head> | |
<body> | |
<h1>Silmukkarakenteet</h1> | |
<?php | |
/* While-silmukka. */ | |
$k = 1; | |
while( $k < 101 ) { | |
echo "Luku on " . $k . "<br />\n"; | |
$k++; // Sama asia kuin $k = $k + 1 eli lisätään luku 1 | |
} | |
/* Sama asia for-silmukka. */ | |
for( $s=1; $s < 101; $s++ ) { | |
echo "Luku on " . $s . "<br />\n"; | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment