Skip to content

Commit

Permalink
Adds example for input
Browse files Browse the repository at this point in the history
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 1e61135
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions doc/Language/py-nutshell.pod6
Expand Up @@ -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

Expand Down

0 comments on commit 1e61135

Please sign in to comment.