Results 1 to 6 of 6

Thread: CountBy(*);

  1. #1
    Join Date
    Sep 2007
    Posts
    638
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default CountBy(*);

    This is a function I thought I would make when I was bored...
    It's kinda fun to play with for about 1 min

    Won't work without boolean at the end but keeps giving me "result not used"
    any help with that woudl be apreciated

  2. #2
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    What exactly do you want to make?



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  3. #3
    Join Date
    Sep 2007
    Posts
    638
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I just want to make it count...which it already does
    but I don't want it to give me "result not used"

  4. #4
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    SCAR Code:
    program new;

    procedure CountBy(Number,Times,WaitTime: Integer);
    var
      a,b: Integer;
    begin
      a:=0;
      b:=0;
      repeat;
        a:=a+Number;
        b:=b+1;
         WriteLn(IntToStr(a));
        Wait(WaitTime);
      until(b+1 > Times);
    end;

    begin
      CountBy(1, 3, 1);
    end.

    I changed it to a procedure, procedures don't return anything; they just do what they're told.
    Functions on the other hand return something (Boolean, Integer, String).
    In your procedure you didn't need to return anything..
    Hup Holland Hup!

  5. #5
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if you want it to return something then put

    Result := 'what you want returned'

    so for a number its

    function HeyThere : integer;
    begin
    Result:= 5;
    end;
    The truth finally came out...


  6. #6
    Join Date
    Sep 2007
    Posts
    638
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for telling me about putting it as a procedure nielsie95...
    And thanks Mat for telling me about results

Thread Information

Users Browsing this Thread

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

Posting Permissions

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