Skip to content

Commit

Permalink
Add some information to the input section
Browse files Browse the repository at this point in the history
Change variable name: entered -> user_input
Add some information to the section and reflow text.
  • Loading branch information
uzluisf committed Oct 13, 2018
1 parent 304ae01 commit 920e243
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions doc/Language/py-nutshell.pod6
Expand Up @@ -15,7 +15,7 @@ constructs and idioms.
Let's start with printing "Hello, world!". L<put> in Perl 6 is the
equivalent of L<print> in Python. Like Python 2, parentheses are
optional. A return is added to the end of the line.
optional. A return is added to the end of the line.
Python 2
Expand Down Expand Up @@ -728,17 +728,21 @@ run on entering or leaving a block.
=head2 X<C<input>|Python>
In Python 3, the C<input> keyword is used to prompt the user:
In Python 3, the C<input> keyword is used to prompt the user. C<input> can be
provided with an optional argument which is written to standard output without
a trailing newline:
=begin code :lang<python>
entered = input("Say hi → ")
print(entered)
user_input = input("Say hi → ")
print(user_input)
=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:
my $entered = prompt(" Say hi → ");
say $entered # OUTPUT: whatever you entered.
When prompted, you can enter C<Hi> or any other string, which will be stored
in the C<user_input> variable. This is similar to L<prompt> in Perl 6:
my $user_input = prompt("Say hi → ");
say $user_input; # OUTPUT: whatever you entered.
=end pod

Expand Down

0 comments on commit 920e243

Please sign in to comment.