Skip to content

Swap two variables

Pascal via temp variable

Flowchart (ISO 5807)

StartInput a, bt = aa = bb = tEndFigure 1 — Swap

Source code

Pascal
procedure Swap(var a, b: integer);
var t: integer;
begin
  t := a;
  a := b;
  b := t;
end;

The editor opens with this code — change it and the chart redraws.

Language
Pascal
Constructs
via temp variable
Topic
Input/Output
Formats
Word, Visio, draw.io, PDF, SVG

Related examples