Skip to content

Commit 920e243

Browse files
committed
Add some information to the input section
Change variable name: entered -> user_input Add some information to the section and reflow text.
1 parent 304ae01 commit 920e243

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

doc/Language/py-nutshell.pod6

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ constructs and idioms.
1515
1616
Let's start with printing "Hello, world!". L<put> in Perl 6 is the
1717
equivalent of L<print> in Python. Like Python 2, parentheses are
18-
optional. A return is added to the end of the line.
18+
optional. A return is added to the end of the line.
1919
2020
Python 2
2121
@@ -728,17 +728,21 @@ run on entering or leaving a block.
728728
729729
=head2 X<C<input>|Python>
730730
731-
In Python 3, the C<input> keyword is used to prompt the user:
731+
In Python 3, the C<input> keyword is used to prompt the user. C<input> can be
732+
provided with an optional argument which is written to standard output without
733+
a trailing newline:
732734
733735
=begin code :lang<python>
734-
entered = input("Say hi → ")
735-
print(entered)
736+
user_input = input("Say hi → ")
737+
print(user_input)
736738
=end code
737739
738-
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:
739740
740-
my $entered = prompt(" Say hi → ");
741-
say $entered # OUTPUT: whatever you entered.
741+
When prompted, you can enter C<Hi> or any other string, which will be stored
742+
in the C<user_input> variable. This is similar to L<prompt> in Perl 6:
743+
744+
my $user_input = prompt("Say hi → ");
745+
say $user_input; # OUTPUT: whatever you entered.
742746
743747
=end pod
744748

0 commit comments

Comments
 (0)