Jump to content
Sign in to follow this  
sandman

For loops.. increasing something and the array count?

Recommended Posts

sandman

I'm surprised that I forgot how to do this.. anyway...

I have set up a function that will do this (in chronological order)

  • Read a file
  • Analyze that file
  • Based on a integer value in the file, read a file with the prefix 'news' and then a number
  • Keep doing that until the number matches the number in the file
So, I want this in an array, too. This is my prospective code.. probably nothing near what I should be doing:

$pgnumval = FileRead("news.txt")

For $i = 0 To $pgnumval Step 1
        $i[+1] = FileRead("news" & $i & ".txt")
Next

What are your thoughts on this.. and how can I do it?

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
BrettF

I'm surprised that I forgot how to do this.. anyway...

I have set up a function that will do this (in chronological order)

  • Read a file
  • Analyze that file
  • Based on a integer value in the file, read a file with the prefix 'news' and then a number
  • Keep doing that until the number matches the number in the file
So, I want this in an array, too. This is my prospective code.. probably nothing near what I should be doing:

$pgnumval = FileRead("news.txt")

For $i = 0 To $pgnumval Step 1
        $i[+1] = FileRead("news" & $i & ".txt")
NextoÝ÷ ÙhZµªÞÊ«¶.l¢{aƧv0q©Èv­þ«¨µäáȬ{ayªëk&uû§rب«­¢+Ø(%%%ÍÉÉä ÀÌØíÙÉÉä¤Q¡¸($%I¥´ÀÌØíÙÉÉåmU    ½Õ¹ ÀÌØíÙÉÉ䤬Åt($$ÀÌØíÙÉÉåmU ½Õ¹ ÀÌØíÙÉÉ䤴ÅtôÀÌØíÍY±Õ($%MÑÉÉ½È À¤($%IÑÕɸÄ(%±Í($%MÑÉÉ½È Ä¤($%IÑÕɸÀ(%¹%(

Share this post


Link to post
Share on other sites
sandman

I just read the ArrayAdd function.. so couldn't I just do it like this?

Dim $pgnews[0]

For $i = 0 To $pgnumarticles Step +1
    _ArrayAdd($pgnews, "news" & $i & ".txt")
Next
Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
sandman

Okay, one more thing: How can I return all parts of an array? Will Return $array do it? Or is it not that simple?


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
BrettF

Okay, one more thing: How can I return all parts of an array? Will Return $array do it? Or is it not that simple?

Like this:

For $i = 1 to Ubound($array) -1
Msgbox (0, "Array Part: " &$i, "Value:" &@CRLF&$array[$i])
Next

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×