I have also changed the way methods execute their code. Methods may now return a list object instead of just variables, strings, and numeric values. Any variables or lists created within the method are implicitly removed after leaving the method.
Here is an example of list slicing:
list list_a
list list_b
list_a = ("abc","bcd","cde","def")
list_b = list_a[0..3] # list_b contains all elements of list_a
list_b = list_a[3..0] # list_b contains all elements of list_a, reversed
Here is an example of iterating a sub-string:
@string "Hello, World!"
# loop a substring
for c in @string[0..12]
say ${c}
endfor
# reversed
for c in @string[12..0]
say ${c}
endfor
Here is an example of retrieving a sub-string:
@string = "Hello, World!" @sub_str = @string[0..12] @reversed = @string[12..0]Here is an example of the new methods:
method get_even_numbers
list even_numbers
for x in (0..15)
if (${x}%2) == 0
even_numbers += ${x}
endif
endfor
return even_numbers
end
list numbers
numbers = get_even_numbers
To download 3.7.8, you can visit any of the following links:
sourceforge
freecode
This a comprehensive work. Like this. Keep it up
ReplyDelete