<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-07-20 11:03 GMT+02:00 Bo Berglund <span dir="ltr"><<a href="mailto:bo.berglund@gmail.com" target="_blank">bo.berglund@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">So since I don't really want to use a global, is it possible to<br>
declare a local variable static in the sense that it retains its<br>
values across calls to the procedure?<br>
If so how is it done?<br></blockquote><div><br></div><div>procedure foo;</div><div>{$PUSH}</div><div>const{$J+}</div><div> s : string ='';</div><div>{$POP}</div><div>begin</div><div> writeln(s);</div><div> if s = '' then</div><div> s := 'hello from static local variable';</div><div>end;<br></div></div><div><br></div><div>begin</div><div> foo; // will print empty line</div><div> foo; // will print 'hello from static local variable'</div><div> foo; // will print 'hello from static local variable'</div><div>end.</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Best regards,<br>Maciej Izak</div></div></div>
</div></div>