How to concatenate string with integer in Pascal

1 Answer

0 votes
program ConcatenateStringAndInteger;

uses
  SysUtils; // IntToStr

var
  str: string;
  n: Integer;
  resultString: string;

begin
  str := 'The number is: ';
  n := 42;

  // Convert integer to string and concatenate
  resultString := str + IntToStr(n);

  WriteLn(resultString);
end.



(*
run:

The number is: 42

*)

 



answered Jun 17, 2025 by avibootz
...