Monday, October 3, 2011

Jana Chapman, Number 5

I'm the fifth child in my family. If there was a table with all the children in my family, I would be number 5.

When you get to the end of a playlist, it usually loops.

JavaScript:
for (i=1; i++; i<=10){
document.write(i)
}

php:
for ($i=0; i<101;i++){
print(i)
}

lua:
for i=0, 100 do
print(i)
end

You can use arrays and lists to get through numbered lists/variables.

Arrays
  • A box of 12 crayons - "Get the first one from the right."
  • An order of family members.
  • "Hash" = an associative array
JavaScript: (starts with 0)
for (i=1; i++; i<=10){
document.write(i)
}

var myFamily={"John", "Kimball", "Karen", "Kathryn", "Jana", "Sara", "Kristen"}
alert{myFamily[5]};

Modularizing in your code helps you iterate through your arrays.

No comments: