IB Comp Sci SL - October 11 2016 Lesson Notes: Difference between revisions
Mr. MacKenty (talk | contribs) (Created page with " __NOTOC__ <table cellspacing="10" style="width:100%;"> <tr> <td style="width:50%; margin:0; margin-top:10px; margin-right:10px; border:1px solid #dfdfdf; padding:0 1em 1em 1...") |
Mr. MacKenty (talk | contribs) |
||
Line 5: | Line 5: | ||
==[[File:class_plan.png]] What are we going to learn today?== | ==[[File:class_plan.png]] What are we going to learn today?== | ||
# Today in class we will start learning about collections. | # Today in class we will start learning about collections and arrays. THESE ARE DIFFERENT. | ||
<syntaxhighlight lang="php"> | |||
<?php | |||
# this file is used to teach the VERY BASICS of arrays in PHP | |||
$shop_items = array( | |||
"short sword", | |||
"dagger", | |||
"flail", | |||
"morning star", | |||
"spear", | |||
"long bow", | |||
"crossbow", | |||
"long sword", | |||
"two handed sword", | |||
"scimitar", | |||
"short bow", | |||
"staff", | |||
"club" | |||
); | |||
# This creates a very simple array. | |||
# We can perform some different operations on this array: | |||
# count the items in the array: | |||
echo "<p>Welcome to our shop. We sell many things for adventurers </p>"; | |||
echo "<p>==========================================</p>"; | |||
# let's list our inventory: | |||
for ($i = 0; $i < count($shop_items); $i++) | |||
{ | |||
echo $i . " - $shop_items[$i] <br />"; | |||
} | |||
?> | |||
</syntaxhighlight> | |||
</td> | </td> |
Revision as of 08:12, 11 October 2016
What are we going to learn today?[edit]
<?php
# this file is used to teach the VERY BASICS of arrays in PHP
$shop_items = array(
"short sword",
"dagger",
"flail",
"morning star",
"spear",
"long bow",
"crossbow",
"long sword",
"two handed sword",
"scimitar",
"short bow",
"staff",
"club"
);
# This creates a very simple array.
# We can perform some different operations on this array:
# count the items in the array:
echo "<p>Welcome to our shop. We sell many things for adventurers </p>";
echo "<p>==========================================</p>";
# let's list our inventory:
for ($i = 0; $i < count($shop_items); $i++)
{
echo $i . " - $shop_items[$i] <br />";
}
?>
|
Homework[edit]
|
|
How am I being assessed today?[edit]
|
||
Standards we are covering today[edit]
|
As a computer scientist, you have:[edit]
|
|
Credits[edit] |