Free invites for everyone

comment = '' (1..9).each do |number| comment = 'is even' if number % 2 == 0 puts "#{number} #{comment}" end
This code prints:

Alice: Invite!
Bob: Invite!

Why are both invited, although none of them should be? And how can you fix the code?

2 Responses

Funny thing is that there are in fact two issues here.
Once you fix the first described here, modify alice hash entry with 'knowsSQL: true' so that Alice will be invited.
Run the code and it prints:
Alice: Invite!
Bob: Invite!

Why?
Funny thing is that there are in fact two issues here.
Once you fix the first described here, modify alice hash entry with 'knowsSQL: true' so that Alice will be invited.
Run the code and it prints:
Alice: Invite!
Bob: Invite!

Why?

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.