Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/dist/src/sysel/demos/varargs.sy

    r23de644 ra95310e  
    3333        -- with the attribute 'packed'.
    3434        --
    35         fun Print(args : string[], packed) is
     35        -- Note that we need to pass 'n' just because the array type
     36        -- does not implement the Length property yet.
     37        --
     38        fun Print(n : int; args : string[], packed) is
    3639                var i : int;
    37                 var error : int;
    3840
    39                 error = 0;
    4041                i = 0;
    41                 while error == 0 do
    42                         -- This is definitely the wrong way to determine
    43                         -- array bounds, but until a better one is
    44                         -- implemented...
    45                         do
    46                                 Builtin.WriteLine(args[i]);
    47                         except e : Error.OutOfBounds do
    48                                 error = 1;
    49                         end
    50 
     42                while i < n do
     43                        Builtin.WriteLine(args[i]);
    5144                        i = i + 1;
    5245                end
     
    5447
    5548        fun Main() is
    56                 Print("One", "Two", "Three", "Four", "Five");
     49                Print(5, "One", "Two", "Three", "Four", "Five");
    5750        end
    5851end
Note: See TracChangeset for help on using the changeset viewer.