-
-
Save mistyrinth/666cfd9b7c9fc0f0a8f3c6347ada4fe3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = [1, 3, 7, 2, 4, 10, 8] | |
puts "元の配列は #{array} です" | |
# 逆順に並び替え | |
newarray1 = array.reverse | |
puts "逆順に並び替えると #{newarray1} です" | |
# ソート | |
newarray2 = array.sort | |
puts "ソートすると #{newarray2} です" | |
# 配列を行列に並べ替え | |
ary = [[1, 2], [3, 4], [5, 6]] | |
puts "元の配列は #{ary} です" | |
newary = ary.transpose | |
puts "行と列を入れ替えると #{newary} です" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment