Sign in to follow this  
Followers 0
Aceguy

sequencing..... for & next

9 posts in this topic

#1 ·  Posted (edited)

how can i calulate this squence

1=a

2=b

3=c

4=d

5=e

6=f

7=g

8=h

9=a

10=b

11=c

12=d

ect.

first number carrys on, second number only goes to h, then back to a.

also.... if i know the first number of say 263, what second letter be(a to h).?

:) you help is much appreciated.

Edited by Aceguy

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I didn't get it can u explain?

EDIT

I'm becoming too slow !!

Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$Find = Find(55)
$Find2 = Find(55, 2)
MsgBox("", "", "55. result : " & $Find & @CRLF & "All results until 55 : " & $Find2)

Func Find($Num, $Type = 1)
    Local $Count = 0, $Var
    For $i = 1 To $Num
        $Count += 1
        If $Count = 9 Then $Count = 1
        If $Type = 1 Then
            $Var = Chr(96 + $Count)
        Else
            $Var &= Chr(96 + $Count)
        EndIf
    Next
    Return $Var
EndFunc

Edited by Jex

Share this post


Link to post
Share on other sites

Hello,

maybe Mod() can help you:

Global $a[8] = ['h','a','b','c','d','e','f','g']

$i=4
ConsoleWrite($a[Mod($i,8)]&@LF)
$i=8
ConsoleWrite($a[Mod($i,8)]&@LF)
$i=12
ConsoleWrite($a[Mod($i,8)]&@LF)
$i=20
ConsoleWrite($a[Mod($i,8)]&@LF)
$i=263
ConsoleWrite($a[Mod($i,8)]&@LF)

ciao

Xandl

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

if i know the first number of say 263, what second letter be(a to h).?

For your second question :

$MyNumber = 263
$Find = Find($MyNumber + 1)
MsgBox("", "", $Find)

Func Find($Num, $Type = 1)
    Local $Count = 0, $Var
    For $i = 1 To $Num
        $Count += 1
        If $Count = 9 Then $Count = 1
        If $Type = 1 Then
            $Var = Chr(96 + $Count)
        Else
            $Var &= Chr(96 + $Count)
        EndIf
    Next
    Return $Var
EndFuncoÝ÷ Ú«¨µáÞZ&k&Þ2jx^¨»ú®¢×¢êì¢[­ÛzÛ^®ØZlv÷öÙ'£hÂj~éܶ*'ÂäxºÚ"µÍÌÍÕ[YH[Y[]

BÌÍÑ[H[
ÊBÙÐÞ
    ][ÝÉ][ÝË    ][ÝÉ][ÝË    ÌÍÑ[ [È ][ÝÈ  ][ÝÈ  [È[YY  ÌÍÕ[YJBÌÍÕ[YH[Y[]

BÌÍÑ[H[ÊBÙÐÞ
    ][ÝÉ][ÝË    ][ÝÉ][ÝË    ÌÍÑ[ [È ][ÝÈ  ][ÝÈ  [È[YY  ÌÍÕ[YJB[È[
    ÌÍÓ[K    ÌÍÕHHJBSØØ[    ÌÍÐÛÝ[H    ÌÍÕQÜ   ÌÍÚHHHÈ ÌÍÓ[BBIÌÍÐÛÝ[
ÏHBBRY ÌÍÐÛÝ[HH[  ÌÍÐÛÝ[HBBRY    ÌÍÕHHH[BBIÌÍÕHÚM
È  ÌÍÐÛÝ[
BBQ[ÙBBBIÌÍÕ    [ÏHÚM
È  ÌÍÐÛÝ[
BBQ[YS^T]   ÌÍÕ[[ÈÏOIÝÑ[[È[ ÌÍÓ[JBSØØ[ ÌÍÐ^VÎHHÉÌÎNÚ   ÌÎNË ÌÎNØIÌÎNË ÌÎNØÌÎNË  ÌÎNØÉÌÎNË    ÌÎNÙ ÌÎNË ÌÎNÙIÌÎNË ÌÎNÙÌÎNË  ÌÎNÙÉÌÎN×BT] ÌÍÐ^VÓ[Ù
    ÌÍÓ[K
WB[[ÈÏOIÝÑ[

For test calculation speeds and your function more fast :)

Edited by Jex

Share this post


Link to post
Share on other sites

Hello,

I don't know how mod function working.

Mod returns the remainder of a division. That sounds complicated.

But (x mod y) just returns a value between 0 and y-1, this sounds useful for arrays.

So we put the last item 'h' into array element 0, to not let it be empty.

Whichever value comes from x, mod will always return a value between 0 and y-1.

ciao

Xandl

Share this post


Link to post
Share on other sites

it's like back in forth grade, you know the 'remainder' lol like 4 goes into 14, 3 times with a remainder of 2...

Hope that helps


[center][/center]

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  
Followers 0