OPTION _EXPLICIT

REM $Include: 'SoftArrays.bi'

PRINT "Task 1/2: Store the name and country of three friends in 2D Array:"

DIM Regular2DArray(3, 2) AS STRING
Regular2DArray(1, 1) = "Steve"
Regular2DArray(1, 2) = "USA"
Regular2DArray(2, 1) = "Fellippe"
Regular2DArray(2, 2) = "Brazil"
Regular2DArray(3, 1) = "Luke"
Regular2DArray(3, 2) = "Australia"
DIM i AS INTEGER
DIM j AS INTEGER
FOR i = 1 TO UBOUND(Regular2DArray, 1)
    FOR j = 1 TO UBOUND(Regular2DArray, 2)
        PRINT Regular2DArray(i, j);
        IF (j < UBOUND(Regular2DArray, 2)) THEN PRINT " -> ";
    NEXT
    PRINT
NEXT
PRINT
PRINT "Printing 2,2 entry: "; Regular2DArray(2, 2)

PRINT
PRINT "..."
PRINT

PRINT "Task 2/2: Store the name and country of three friends in Soft Array:"

DIM a AS LONG
DIM b AS LONG
a = NewSoftArray("Friends")
a = LinkEast(a, NewTextNode("Steve"))
b = LinkEast(a, NewTextNode("USA"))
a = LinkSouth(a, NewTextNode("Fellippe"))
b = LinkEast(a, NewTextNode("Brazil"))
a = LinkSouth(a, NewTextNode("Luke"))
b = LinkEast(a, NewTextNode("Australia"))
PRINT PrintSoftArray(SoftArrayID("Friends"))
PRINT
PRINT "Printing 2,2 entry: ";
a = JumpFrom(Content("Friends"), "s", 1)
b = JumpFrom(a, "e", 1)
PRINT Literal$(b)

END

REM $Include: 'SoftArrays.bm'
