On Jan 7, 2009, at 2:36 AM, Tomasz Krakowski wrote:

> James Gray wrote:
>
>> I promise to use that to fix any bugs it uncovers.  Fair enough?
>
> Thank you James for your patience :)

I'm glad we're getting it figured out.

> Here is sample script:

OK, the short story is that there's no bugs here.  You are just  
running into surprising "features" of Ruby.

First, let me show how to fix your code:

> #!/usr/bin/env ruby -wKU
>
> require "rubygems"
> require "highline/import"
>
> ip = [
>  ["tvp1", "219.239.2.1"],
>  ["tvp2", "219.239.2.2"],
>  ["tvp info", "219.239.2.3"],
>  ["polsat", "219.239.2.4"],
>  ["tvn", "219.239.2.5"],
>  ["tvp kultura", "219.239.2.6"],
>  ["tvp polonia", "219.239.2.7"],
>  ["tvp historia", "219.239.2.9"]]
>
>  choose do |menu|
>     menu.prompt = "Please choose your test:   "
>         for j in 0..ip.length-1

ip.each_with_index do |row, i|

>           menu.choice(:"#{ip[j][0]}\t\t\t#{ip[j][1]} ",  
> "blabla#{j}") do

menu.choice("#{row.first}\t\t\t#{row.last} ", "blabla#{i}") do

>             puts "#{ip[j][0]}\t\t\t#{ip[j][1]} - your choice"

puts "#{row.first}\t\t\t#{row.last} - your choice"

>
>           end
>         end#for
>    end

Those simple changes should make your code run as expected.

> on my compilation there is always executed last option. Does not  
> matter
> which one you pick.

For an explanation of why you were seeing this, please see this write  
up on my blog:

http://blog.grayproductions.net/articles/the_evils_of_the_for_loop

James Edward Gray II