naugty problem with for next in grid calculations

Just starting out? Need help? Post your questions and find answers here.
wimapon
Enthusiast
Enthusiast
Posts: 290
Joined: Thu Dec 16, 2010 2:05 pm
Location: Delfzijl ( The Netherlands )
Contact:

Re: naugty problem with for next in grid calculations

Post by wimapon »

hi Infratec, long time no see. good to see you again.
Thanks for your replay.
I did in the early days a lot of assembler programming.
I do know what you mean, but in that days gwbasic and quickbasic did not have that problem.

My problem is: for i = a to b step c does not work if c is an integer.
for i = a to b step 5 does work okay.

So i can not calculate the value of c , and that looks strange.
Or is there a way to change an integer into a number in purebasic?

Wim
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4955
Joined: Sun Apr 12, 2009 6:27 am

Re: naugty problem with for next in grid calculations

Post by RASHAD »

My problem is: for i = a to b step c does not work if c is an integer.
for i = a to b step 5 does work okay.
c most likely is a variable and that is not supported by PB
So use maybe it will help

Code: Select all

  For i= a to b
  	your code here
  	calculate c or get it from previous calculation or read it from DataSection then
  	i + c 
  Next
Egypt my love
wimapon
Enthusiast
Enthusiast
Posts: 290
Joined: Thu Dec 16, 2010 2:05 pm
Location: Delfzijl ( The Netherlands )
Contact:

Re: naugty problem with for next in grid calculations

Post by wimapon »

okay Rashad,
Your idea is awesome

i like to do: for i = a to b step c
pure basic does not allow this.
only this works: for i = a to b step 5

so if i do it the way below, this problem is solved.
It is a bit dirty, but it works
Thanks.



Code: Select all

a = 5
b = 20
c = 5  

For i = a To b 
  ; do the calculations with i
  Debug i
  i = i + c - 1
Next i
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4955
Joined: Sun Apr 12, 2009 6:27 am

Re: naugty problem with for next in grid calculations

Post by RASHAD »

You are welcome :)
Egypt my love
Post Reply