Towers of Hanoi: Difference between revisions

Content added Content deleted
(Added an Algol W sample)
m (Added the Sidef language)
Line 2,944: Line 2,944:
end if;
end if;
end func;</lang>
end func;</lang>

=={{header|Sidef}}==
{{trans|Perl}}
<lang ruby>func hanoi(n, from=1, to=2, via=3) {
if (n == 1) {
say "Move disk from pole #{from} to pole #{to}.";
} else {
hanoi(n-1, from, via, to);
hanoi( 1, from, to, via);
hanoi(n-1, via, to, from);
}
}

hanoi(4);</lang>


=={{header|SNOBOL4}}==
=={{header|SNOBOL4}}==