From: Dave Elman Date: 2012-01-21T18:40:54+09:00 Subject: (Beginner Question) Trying to extract elements from an embeded array Hiya All, I've been learning Ruby for about 2 weeks or so and had a go at putting together proper bit of code, which I of course can't get working ;) Part of my practice is to see how if..., while..., collect... and so on work. In the code I have a set of embedded arrays with various strings. I then generate a sequential number (0, 1, 2, etc) and a random number. With those I index into each array in sequence using the sequence number, and use the random number to pick a string at random from within them. The output should be say "a, B" or "c, A", etc. I've been testing this in SciTe and get results of either [nil, nil] or just "a, b" every time. Running it in Codepad I got [nil, nil] and [98, 98]. How the heck I can get nil, nil I don;t know, I'm guessing I'm getting int/str mixed up here. If anyone has a moment, could you look over the code I pasted at Codepad. Any guidance on what I'm missing here technically and logically would be greatly appreciated. http://codepad.org/ohuMRrlE Regards, Dave. -- Posted via http://www.ruby-forum.com/.