アルファベットの配列を反復処理して 6 文字 (アルファのみ) の文字列をすべて生成しようとすると、最も内側にネストされたループの単一の while ループの後で反復が終了するようです。以下のコード。考え?
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
x1 = 0
x2 = 0
x3 = 0
x4 = 0
x5 = 0
x6 = 0
while x1<26
y1 = alpha[x1]
while x2<26
y2 = alpha[x2]
while x3<26
y3 = alpha[x3]
while x4<26
y4 = alpha[x4]
while x5<26
y5 = alpha[x5]
while x6<26
y6 = alpha[x6]
puts y1 + y2 + y3 + y4 + y5 + y6
x6 = x6 + 1
end
x5 = x5 + 1
end
x4 = x4 + 1
end
x3 = x3 + 1
end
x2 = x2 + 1
end
x1 = x1 + 1
end
編集:望ましい結果を達成するためのはるかに簡単な方法を見落としている可能性も非常に高いです。もしそうなら、私を修正してください。