Sunday, September 25, 2011

USL 3.7.1

In this release I added while loops, constants, switch statements, and exponential operators. I also updated the comprehensive help function.

The while loops are the only loops that can contain nested for loops at the moment. I have to fix nesting for loops but I work around that with while loops now.  While loops expressions must begin with a numeric variable to toggle.  I haven't programmed strings for while loop expressions yet but that will come soon (probably tomorrow).

Here is an example:
@a = 1
@b = 10
while @a <= @b
        for 5 > 1
                out "${$} "
        @a += 1

The switch statements require a variable to be switched against. The variable may be either string or number and the cases may be both string or number. If no cases match, a default block of code will be parsed.

Here is an example:
method example
        @c = "This is a string."

        switch @c
                case "This is a string"
                        say "Not quite..."
                        say "The next case will be evaluated."
                case 3.14159
                        say "That is pi..."
                case "This is a string."
                        say "A match was found!"
                        say "No match was found..."


Constant values are immutable, meaning you cannot alter them. Constant identifiers may only contain characters A through Z and underscores. Constant variables are only used to assign values to variables.

Here is an example:
MY_CONST = "This value is immutable."
@c = MY_CONST 
say @c

The exponential operator **= assigns a numeric variable to the power of a given operand.

Here is an example:
@d = 25.6
@d **= 2

say @d

I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.

To download 3.7.1, you can visit any of the following links:


No comments:

Post a Comment