@@ -761,6 +761,32 @@ in the C<user_input> variable. This is similar to L<prompt|/routine/prompt> in R
761
761
my $user_input = prompt("Say hi → ");
762
762
say $user_input; # OUTPUT: whatever you entered.
763
763
764
+ = head2 X < Tuples|Python >
765
+
766
+ Python tuples are immutable sequences. The sequence elements do not need
767
+ to be of the same types.
768
+
769
+ Python
770
+
771
+ = for code :lang<python>
772
+ tuple1 = (1, "two", 3, "hat")
773
+ tuple2 = (5, 6, "seven")
774
+ print(tuple1[1]) # OUTPUT: «two»
775
+ tuple3 = tuple1 + tuple2
776
+ print(tuple3) # OUTPUT: «(1, 'two', 3, 'hat', 5, 6, 'seven')»
777
+
778
+ Raku
779
+
780
+ Raku does not have a builtin Tuple type, though they are available as modules.
781
+ You can obtain the same behavior from Raku using the List type.
782
+
783
+ my $list1 = (1, "two", 3, "hat");
784
+ my $list2 = (5, 6, "seven");
785
+ say $list1[1]; # OUTPUT: «two»
786
+ my $list3 = slip($list1), slip($list2);
787
+ my $list4 = |$list1, |$list2; # equivalent to previous line
788
+ say $list3; # OUTPUT: «(1, two, 3, hat, 5, 6, seven)»
789
+
764
790
= end pod
765
791
766
792
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
0 commit comments