Page 1 of 1 1
Topic Options
#77903 - 2001-06-04 10:50 AM Arrays in Kixtart 2001 4.00 Beta 2
Anonymous
Unregistered


I have a problem understanding arrays in Kixtart. According to the documentation, arrays are by default arrays of integers, but as soon as you assign a string value to an array element, the element should become string. This example:

BREAK ON

Dim $Outp[3]

$i = 0

WHILE $i < 2
$Outp[$i] = CHR($i + 65)
$i = $i + 1
LOOP

; --------------------------

$i = 0

WHILE $i < 2
? $i + " : " + $Outp[$i]
$i = $i + 1
LOOP

should generate this:

0 : A
1 : B

but produces this:

0
1

Anyone who knows why?

Top
#77904 - 2001-06-04 11:27 AM Re: Arrays in Kixtart 2001 4.00 Beta 2
Anonymous
Unregistered


OK - my mistake. The example below demonstrates how to deal with this issue. Note the way I export the $Outp array from the function ... I never thought it would work!
---------------
BREAK ON

DIM $Outp[3]

$Outp = ClearOutp($Outp)
PrintOutp($Outp)

FUNCTION ClearOutp($Outp)
$i = 0
WHILE $i < 3
$Outp[$i] = "A"
$i = $i + 1
LOOP
$ClearOutp = $Outp
ENDFUNCTION

FUNCTION PrintOutp($Outp)
$i = 0
WHILE $i < 3
? $Outp[$i]
$i = $i + 1
LOOP
ENDFUNCTION

Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.05 seconds in which 0.031 seconds were spent on a total of 12 queries. Zlib compression enabled.