INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Converting BASIC to Delphi 7 Problem

Converting BASIC to Delphi 7 Problem

(OP)
Hello All,

I've been engaged in translating some Basic applications into Delphi 7. I got to a triple-nested set of For loops in Basic and the innermost loop had a 'STEP' specification. It took me awhile to recall what that was and, as I recall, one can specify that a loop going through an Array can, instead of taking one at a time can be Stepped to go to every 3rd or 5th or nth place in the Array. An example of the BASIC For loop Line of code is as follows,
"FOR I% = 0 TO 32768 STEP 10".

Obviously a trivial example but I hope it clarifies what I'm trying to explain.
I can't recall and have been unable to find in my Pascal/Delphi texts an example anything similar in Delphi 7. I think I can gin up a 'While' or 'Repeat' loop to work but it'd be much more self-explanatory and self-commenting to have a STEP in Delphi to use.
Is anyone aware of such an option in Delphi For loops?

Bill Kilgore

RE: Converting BASIC to Delphi 7 Problem

(OP)

Thank you, imex. I thought that would be the case.

Bill Kilgore

RE: Converting BASIC to Delphi 7 Problem

Or you could use a for loop such as:

CODE

//"FOR I% = 0 TO 32768 STEP 10".
For I:=0 to 32768 div 10
   X:=Array[I*10]; //access every tenth item 

RE: Converting BASIC to Delphi 7 Problem

(OP)
Prattaratt,

Thanks for taking the time. I don't think I'd have come up with that one and it looks like it will work.
I learned long ago to always get other eyes to look things over and it's always worked.

Thanks again,

Bill Kilgore

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close