Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / any help please?

Author
Message
yr un olaf
18
Years of Service
User Offline
Joined: 28th May 2006
Location:
Posted: 1st Jun 2006 14:23
Hi
i was wondering if someone could help me with this, i am trying to learn about array by fiddling around with them trying different things. I thought of a silly little thing to do but cant work out how to do it (which is frustrating me :\'( ), here is my code so far



but basicly what i want it to do is if the input in the first loop is less than 20 then print set(1), and then if the input is less than 20 the second time around then print set(2) etc, until a number over 20 is put in in which case it goes back to the start and if another number under 20 is put in again it prints set(1).

Its silly i know but i was hoping someone could help me work out how to do it.

Thank you
Zeddex
18
Years of Service
User Offline
Joined: 4th May 2006
Location:
Posted: 1st Jun 2006 15:21
you want a diff set(x) at each number under 20 ??



i'm not sure if is that you want but i don't anderstand very well what you want.

If Zeddex can, you can. If you have an idea, make it.
yr un olaf
18
Years of Service
User Offline
Joined: 28th May 2006
Location:
Posted: 1st Jun 2006 15:44
i'm not sure if thats right, basically i want it so that the first time it goes through the loop, if the input is <20 then it prints out set(1), then the second time it goes through the array if the input is less than 20 again then print set(2), and in the third loop if the input is <20 again then print set(3), and to keep going ion this fasion until a number over 20 is inputed in which case it goes back to the start, eg
1st loop:
input = 1
print set(1)
2nd loop:
input = 12
print set(2)
3rd loop:
input = 5
print set(3)
4th loop:
input = 21
pritn nothing
5th loop:
input = 7
print set(1)

and so on, if you see what i mean.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Jun 2006 16:01
I think this is what you are trying to do. Also, if you get to the end of the array, you need to set it back to 1 or it will crash.





yr un olaf
18
Years of Service
User Offline
Joined: 28th May 2006
Location:
Posted: 1st Jun 2006 16:33
yes that does kinda do it.

i was wondering if you can check to see if a function is true or not, ie

if nbr < 20 then
check()

function check(nbr)
if nbr = 12 then
print " its 12"
endfunction

is there a way of testing wherether that function will print or not?
yr un olaf
18
Years of Service
User Offline
Joined: 28th May 2006
Location:
Posted: 1st Jun 2006 19:10
i was just wondering if there is a way of checking if a function is true or false ie

do
if nbr <20 then
check()
if check is true then
nbr = 1

something like that if you know what i mean

thanks
Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 2nd Jun 2006 13:19
Dont think of it as if the function is true or not, think of it as the number the function returns (I made some other changes just so I could understand the code myself... ignore them, they do not effect you).

Login to post a reply

Server time is: 2024-09-24 23:29:58
Your offset time is: 2024-09-24 23:29:58