Results 1 to 6 of 6

Thread: Need help with simple counter function.

  1. #1
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default Need help with simple counter function.

    I made this:

    SCAR Code:
    function Count(var Starting, Ending : Integer): Boolean;
    begin
     repeat
     Starting := Starting + 1;
     Writeln(''+IntToStr(Starting)+' msec');
     until(Starting = Ending);
    end;

    begin
    Count(1, 50); //When i type here e.x 1, 50; it'll say variable expected.
    end.

    How do i get that i just have to type a from- and to?
    Ce ne sont que des gueux


  2. #2
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't understand really but i think you mean:

    SCAR Code:
    Writeln('From: '+inttostr(Starting)+' to: '+inttostr(Ending));

    [22:20] <[-jesus-]> freddy, go uninstall yourself

  3. #3
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    That wasnt really what i was asking, because i get a 'Variable Expected' error.

    I cant just put:

    Count(1, 50);

    But that ís what i want it to do:

    Count(1, 50); will count from one to fifty if the DebugBox.
    Ce ne sont que des gueux


  4. #4
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    remove Var...

    SCAR Code:
    function Count(Starting, Ending : Integer): Boolean;
    begin
     repeat
       Starting := Starting + 1;
       Writeln(''+IntToStr(Starting)+' msec');
       until(Starting = Ending);
    end;

    begin
    Count(1, 50); //When i type here e.x 1, 50; it'll say variable expected.
    end.

    [22:20] <[-jesus-]> freddy, go uninstall yourself

  5. #5
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Thanks! I think it was taught me wrong.

    R++
    Ce ne sont que des gueux


  6. #6
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure Count(i, ii: Integer);
    var
      t: Integer;
    begin
      for t := i to ii do
        Writeln(IntToStr(t));
    end;

    Edit: I'm a lil late, this is the easiest way tho

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Bmp Counter!
    By Cazax in forum Research & Development Lounge
    Replies: 10
    Last Post: 02-29-2008, 04:26 PM
  2. WearingItemCust simple function
    By hamster in forum Research & Development Lounge
    Replies: 2
    Last Post: 02-29-2008, 01:18 PM
  3. First function (simple :P)
    By Floor66 in forum Research & Development Lounge
    Replies: 3
    Last Post: 02-28-2008, 05:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •