Iterating an Enumeration of Object Members:
# Print all USL environment variables for v in env.get_members say ${v} endfor # An object for demonstration object o @hello = "Hello" @world = "World" method a say "In a()" end method b say "In b()" end method c say "In c()" end end # Print each value of all variables in an object for v in o.get_variables say o.${v} endfor # Execute all methods in an object for m in o.get_methods ! "o.${m}" endforIf you want an enumeration outside of a loop, you can create a list and add to the list as you iterate.
The elif and elsif keywords:
if 0 == 1 say "This is false..." elsif 1 == 0 say "This is a Perl-esque 'else if' statement." elif 1 == 1 say "This is a Python-esque 'else if' statement." endifOther than these examples, there's not much else to show you. Here is how you use the --parse parameter:
./usl -p "for i in (10..1);out '${i}...';delay 1;endfor;say 'blastoff!'"It's a cheesy example of a countdown, but it's pretty neat. The parse parameter is for when you don't feel like running the interactive shell or writing a script. I guess it could have other uses, but that's for you to decide.
Thanks for reading.
To download 3.8.6, you can visit any of the following links:
sourceforge
freecode
github
No comments:
Post a Comment