Permalink
Browse files

Adds example for input

Since there are differences between Python 2 and 3, I just use here
the most similar to Perl 6, which is Python 3 (and say so). Adds
examples for usage in Python and Perl 6. Also reanchors. Refs #2355
  • Loading branch information...
JJ committed Oct 11, 2018
1 parent c962083 commit 1e6113537248d98b7673834db4bdc757dde7a998
Showing with 13 additions and 3 deletions.
  1. +13 −3 doc/Language/py-nutshell.pod6
@@ -728,11 +728,21 @@ run on entering or leaving a block.
say 'world';
}
=head2 Input
X<|raw_input (Python)>
X<|input (Python)>
=head2 Input
In Python 3, the C<input> keyword is used to prompt the user:
=begin code :lang<python>
entered = input("Say hi → ")
print(entered)
=end code
When prompted, you can enter C<Hi> or any other string, which will be stored in
the C<entered> variable. This is similar to L<prompt> in Perl 6:
See the L<prompt> function.
my $entered = prompt(" Say hi → ");
say $entered # OUTPUT: whatever you entered.
=end pod

0 comments on commit 1e61135

Please sign in to comment.