Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

ring The For Loops uses the local scope

x = 10
? x             # Print 10
test1()
? x             # Print 10
test2()
? x             # Print 10

func test1
        for x = 1 to 5
        next
        ? x     # Print 6

func test2
        list = 1:5
        for x in list
        next
        ? x     # Print NULL (The "For In" loop will kill the reference after the loop)
Source by ring-lang.github.io #
 
PREVIOUS NEXT
Tagged: #ring #The #For #Loops #local #scope
ADD COMMENT
Topic
Name
5+6 =