Results 1 to 5 of 5

Thread: Any improvements?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Codeglitch - I like the idea, but not too keen on having the whole prog as a proc, is there no other way?

    chronozphere, that....is a pretty good point....maybe I can use the ascii char for new line to reproduce it...#13? maybe that'd work?
    http://www.webdesignprofessionals.co.uk (any criticism is welcome!)

  2. #2
    I don't see where month:string; variable is used? Remember that compiler should give you hints and warnings about any unnormalities in the code, such as this.

    If you wanted to make a function version of this make sure to take a backup of your program first. What it would mean is that monthnames[] array would be the only public variable remaining, all others would be moved in to main program. The public variables that you use in procedures would be passed in them as parameters. A procedure that currently changes some public variable would become a function and return the new value for that variable. Then in the main program you would set variable the value that function returns.

    Now again, compiler will tell what to do if you encounter errors. We can help describing what they mean if you can't understand them. This is a simple function:
    Code:
    function CombineDate(dd,mm,yy: string): string; // Returns string type variable
    begin
      result:=dd+'\'+mm+'\'+yy;
    end;
    
    // Main program
    var dd, mm, yy, fullDate: string;
    begin
      dd:='30';
      mm:='04';
      yy:='11';
      fullDate := CombineDate(dd,mm,yy);
      writeln(fullDate);
      // Or more directly without fullDate variable
      writeln(CombineDate(dd,mm,yy));
    end;

Bookmarks

Posting Permissions

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