Jump to content

Range of numbers


liten
 Share

Recommended Posts

not really more of something that can be used in this way

$numberrange = 1 to 50

if $currentnumber = $numberrange then

Func()

else

this says if $currentnumber is equal 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 but wiht out havign to type that out

My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Link to comment
Share on other sites

  • 11 years later...

Hi all. It's been almost 11 years since this post. Even so, I would like to give a workaround function. This function is UDF and is inspired in the seq() function in R language. As it returns an 1D array, it also can be indexed easily. I hope can be useful to you all.

Cheers!

 

 

#include-once
#include <Array.au3>

Func seq($from, $to, $by = 1)
Local $vector[0]
Local $strVector

    for $e = $from to $to Step $by
        $strVector = $strVector & $e & ' '
    Next
    $strVector = StringTrimRight($strVector, 1)

_ArrayAdd($vector, $strVector, 0, ' ')
;~ _ArrayDisplay($vector)       <== [Debug]
ConsoleWrite('[1] ' &  $strVector & @CRLF)
Return $vector

EndFunc

 

;Test
$test1 = seq(1, 10)

$test2 = seq(1, 10, 3)


$indexTest3 = seq(1, 10, 1)
ConsoleWrite('[1] ' &  $indexTest3[0] & @CRLF)
ConsoleWrite('[1] ' &  $indexTest3[1] & @CRLF)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...