[21:19] <Spike> anyway.
[21:19] <Spike> so
[21:19] <Spike> an array is basically a list.
[21:19] <Spike> instead of doing this:
[21:19] <Spike> string item1;
[21:19] <Spike> string item2;
[21:19] <Spike> string item3;
[21:19] <Spike> etc
[21:19] <Spike> you can do this:
[21:19] <MrEggsalad> instead of doing Clint's idea okay :P
[21:20] <Spike> string[] item = new string[5];
[21:20] <Spike> what that does
[21:20] <Spike> is
[21:20] <Spike> it tells the system to make 5 "item" variables
[21:20] <Spike> well, 5 strings really.
[21:20] <MrEggsalad> ok
[21:20] <Spike> they're all called item.
[21:20] <MrEggsalad> so item == whatever I want to call it?
[21:20] <Spike> and you access each one by going in sequential order
[21:20] <Spike> starting from 0
[21:21] <MrEggsalad> ok
[21:21] <MrEggsalad> so 0 to 4
[21:21] <Spike> so string[5] contains string[0], string[1] ... string[3], string[4]
[21:21] <Spike> note
[21:21] <Spike> there is no string[5]
[21:21] <Spike> it doesn't exist
[21:21] <Spike> because 0-4 is 5 things
[21:21] <MrEggsalad> yeah
[21:21] <Spike> its kinda weird that wasy
[21:21] <Spike> arrays can be whatever you want
[21:21] <Spike> like im this smiler thing i'm doing
[21:21] <Spike> i have an Image[] array
[21:22] <Spike> now, cay you wanted to do something to each thing in the array
[21:22] <Spike> say... add 5 to an int[] array
[21:22] <Spike> instead of going through each one and saying int[0] = int[0] + 5;
[21:22] <Spike> you can
[21:22] <Spike> er
[21:22] <Spike> i should ask first
[21:22] <Spike> do you know what a for loop is?
[21:23] <MrEggsalad> no =\
[21:23] <Spike> for(... ; ... ; ...) {
[21:23] <Spike> statements;
[21:23] <Spike> }
[21:23] <Spike> ah well
[21:23] <Spike> okay.
[21:23] <Spike> a for loop is a set of commands that get executed more than once
[21:23] <Spike> so
[21:23] <Spike> if we do
[21:23] <Spike> well, the syntax first
[21:23] <Spike> is
[21:23] <MrEggsalad> okay, so I could always route the strings to that for loop? (but continue on the code or whatever)
[21:24] <Spike> for(<statement executed first time> ; <conditional> ; <executed at the end of each loop>)
[21:24] <Spike> {
[21:24] <Spike> }
[21:24] <Spike> i know it seems weird
[21:24] <Spike> but its not
[21:24] <Spike> for an array
[21:24] <Spike> you'd want to do this:
[21:25] <Spike> for(int i = 0; i < numbers.GetUpperBound(); i++) {
[21:25] <Spike> numbers[i] += 5;
[21:25] <Spike> }
[21:25] <Spike> okay
[21:25] <Spike> lets break that down
[21:25] <Spike> first line, the for loop
[21:26] <Spike> it goes in and it says "make variable 'i'."
[21:26] <Spike> and set it to 0
[21:26] <MrEggsalad> ok
[21:26] <Spike> then each time it checks, and it says "hey, keep looping WHILE <this>, and in this case it's while i is less than the number of numbers in our array (whatever it may be)"
[21:26] <Spike> and then after each loop it adds one to i
[21:27] <Spike> you know <variable>++; right?
[21:27] <Spike> and --;
[21:27] <Spike> "?
[21:27] <MrEggsalad> erm..no..
[21:27] <Spike> oh
[21:27] <Spike> okay basically
[21:27] <Spike> var = var + 1; is the SAME THING as var++;
[21:27] <Spike> or -- for -1;
[21:27] <Spike> :)
[21:27] <Spike> so anyway
[21:27] <MrEggsalad> ok
[21:28] <Spike> okay
[21:28] <Spike> back to the loop
[21:28] <Spike> second line is a shorthand way of saying numbers[i] = numbers[i] - 5;
[21:28] <Spike> so var += 5 will add 5 to var
[21:28] <Spike> string += " hello" will add 'hello' to a string
[21:29] <Spike> Clint.IQ -= 100;
[21:29] <Spike> will take 100 points from Clint's IQ.
[21:29] <Spike> just kidding ;)
[21:29] <MrEggsalad> heh
[21:29] <Spike> so thats that
[21:29] <Spike> a for loop is just like
[21:29] <Spike> an easy way to iterate (keyword of the day) over each element in an array.
[21:29] <MrEggsalad> mmkay
[21:30] <Spike> and, no, we couldn't use it to add each UrL
[21:30] <Spike> unless you added a prompt for each one
[21:30] <Spike> something like
[21:30] * Cloudy (~cloudhunt@3b-B4AC8356.range86-136.btcentralplus.com) has joined #Spike
[21:30] <Cloudy> .
[21:30] <Spike> for(...) { url[i] = System.InputBox("Enter the URL for element " + i + ":"); }
[21:32] <Spike> so
[21:32] <Spike> now if you look at my code
[21:32] <Spike> can you see what I did with the array there?
[21:32] <MrEggsalad> I think
[21:33] <Spike> hm
[21:33] <Spike> how do you enable line numbers in vs
[21:33] <MrEggsalad> you set up an array, added URLs to each string
[21:38] <Spike> right-o
[21:38] <Spike> well
[21:38] <Spike> anyway :)
[21:38] <Spike> on line 32, for example
[21:38] <Spike> note we're inside a for loop, so using that variable i is valid
[21:38] <MrEggsalad> yeah
[21:39] <Spike> and i say url[i] <-- which is a string, url[i] = image.fromfile(url[i])
[21:39] <Spike> i could also go image.fromfile("http://image.com/image.jpg")
[21:39] <MrEggsalad> so that finds the url of said image?
[21:39] <Spike> but instead of typing it out twice
[21:40] <Spike> it
[21:40] <Spike> see
[21:40] <Spike> im not sure
[21:40] <Spike> theoretically
[21:40] <Spike> it will download the image from the internet
[21:40] <Spike> so like
[21:40] <Spike> you set up each url, right
[21:40] <Spike> url[0] = blah
[21:40] <Spike> url[1] etc
[21:40] <Spike> then
[21:40] <Spike> i loop through
[21:40] <Spike> and because the url actually points to the image we want... we just loop through and download them.
[21:41] <MrEggsalad> I see
[21:41] <Spike> we say "okay, here's url[0], it's a string. now, go to the Image class and parse that string (which points to the image), download it, and load it into our Image[] array.
[21:41] <Spike> "
[21:41] <Spike> .