Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: nqp_pct
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (33 sloc) 0.759 kb
# Copyright (C) 2001-2010, Parrot Foundation.
=head1 NAME
examples/pir/substr.pir - playing with substr
=head1 SYNOPSIS
% ./parrot examples/pir/substr.pir
=head1 DESCRIPTION
A exuberating C<substr> version of "Hello World".
=cut
.sub "example" :main
$I2 = 1
$I1 = 0
$S1 = "Hello World"
$I3 = 0
$I4 = 0
$I5 = length $S1
WAX: $S2 = substr $S1, $I3, $I4
print $S2
print "\n"
$I4 = $I4 + $I2
if $I4 == $I5 goto WANE
branch WAX
WANE: $I1 = length $S1
print $S1
print "\n"
$S1 = chopn $S1, 1
unless $I1 == $I3 goto WANE
DONE:
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
Jump to Line
Something went wrong with that request. Please try again.