Saturday, October 22, 2011

USL 3.7.9

This release touches up on interpolation. You may now retrieve values from list indices, list ranges, variable indices, variable ranges, and methods to be used in quoted strings. Which means you can print values easier and be more specific with what values are assigned. This release also fixes the chomp and shomp keywords which would originally not format the escape sequences of output strings when retrieving input. It also changes the escape characters from "\]" and "\[" to "\n" and "\t", respectively. Now you may retrieve input in a more formatted manner. This release also allows variables to be used as parameters to the "random" method.

Here are some examples:
@string = "abcdef"

object obj
       method foo(bar)
              return $0
       end

       method bar
              return "Hello, World!"
       end
end

method foo(bar)
       return $0
end

method bar
       return "Hello, World!"
end

list array

array = ("abc","def","ghi")

for i in (0..2)
       say "\{array[${i}]}"
endfor

for i in (2..0)
       say "\{array[${i}]}"
endfor

say "\{@string[5..0]}"
say "\{@string[0..5]}"
say "\{obj.foo(@string)}"
say "\{obj.bar}"
say "\{foo(@string)}"
say "\{bar}"
say "\{array[0..2]}"
say "\{array[2..0]}"

method get_randoms(a,b,c,d)
       @a = $0;@b = $1
       @c = $2;@d = $3

       list rands

       for i in (@a..@b)
              @r = random(@c..@d)

              rands += @r
       endfor

       return rands
end

list randoms

randoms = get_randoms(1,10,a,z)

To download 3.7.9, you can visit any of the following links:
sourceforge
freecode

No comments:

Post a Comment