Michal M. wrote in post #1056320: > > Replace > >> f =!f > > with > > f = false This doesn't make a difference. Both statements set f to false (though yours is of course clearer and eventually safer). @ roboter Y.: What makes you think your program is wrong? It does work correctly (assuming you want to print out the numbers). However, your programming style isn't very "rubyish". It looks more like a Java program or so. In Ruby, it's common to use iterators instead of loops. The advantage of iterators is that all variables created inside the block are local (whereas variables created in loops still exist after the loop has finished). There are also useful iterators like Enumerable#all? and Enumerable#any?, which you can use to avoid low level stuff: def print_primes_between (a, b) 2.upto b do |i| print i, '--' unless (2...i).any? {|j| i % j == 0} end end -- Posted via http://www.ruby-forum.com/.