@@ -15,7 +15,7 @@ constructs and idioms.
15
15
16
16
Let's start with printing "Hello, world!". L < put > in Perl 6 is the
17
17
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.
19
19
20
20
Python 2
21
21
@@ -728,17 +728,21 @@ run on entering or leaving a block.
728
728
729
729
= head2 X < C < input > |Python>
730
730
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:
732
734
733
735
= begin code :lang<python>
734
- entered = input("Say hi → ")
735
- print(entered )
736
+ user_input = input("Say hi → ")
737
+ print(user_input )
736
738
= end code
737
739
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:
739
740
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.
742
746
743
747
= end pod
744
748
0 commit comments