home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,025 of 2,978   
   Hanford Carr <"hwcarr   
   Re: Variables   
   23 Jan 06 12:34:06   
   
   From: "@lmcinvestments.com   
      
   "Michael Sørensen" wrote:   
   >   
   > "Robert AH Prins"  skrev i en meddelelse   
   > news:43clomF1mg7rsU1@individual.net...   
   > > Hi,   
   > >   
   > >> I'm a danish guy with small skills in english - so i hope that you can   
   > >> understand me.   
   > >>   
   > >> Where do I put the "var" (variables) in a unit when you have to be able   
   > >> to use the variable in all the unit?   
   > >   
   > > You can put them wherever you want, both in the interface and in the   
   > > implementation, but if you don't need them outside the unit, the   
   > > implementation is probably the best place as that will hide them   
   > > completely from other units or the main program.   
   >   
   > Hi and thanks.   
   >   
   > But I need some more informations.   
   >   
   > I make an example: ;o)   
   >   
   > Procedure subCalculate;   
   > Var:   
   >   SubResult: integer;   
   > Begin   
   >   some code which ends with   
   >   SubResult:= xxx (a number)   
   > End;   
   >   
   > Procedure Calculate;   
   > Var   
   >   Result:: integer;   
   > Begin   
   > In this procedure i want to use the variable "SubResult" fron the procedure   
   > subCalculate like this.   
   > Result:= SubResult + 1;   
   > End;   
   >   
   > How do i do that.   
      
   Why not use procedures with parameters?   
      
   Procedure subCalculate (Var: SubResult: integer);   
   Begin   
   some code which ends with   
   SubResult:= xxx (a number)   
   End;   
      
   or a function   
      
   Function subCalculate: integer;   
   Begin   
   some code which ends with   
   SubCalculate := xxx (a number)   
   End;   
      
   Cheers Hanford   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca