Reputation: 91
I refactored this code:
if @data.class == Fixnum
bin_num = @data.to_s(2)
else
return results
end
To this:
@data.class == Fixnum ? bin_num = @data.to_s(2) : return results
And my program is getting the error in the title. Am I missing something?
Upvotes: 0
Views: 415
Reputation: 2869
You can use this
return results unless @data.class == Fixnum
bin_num = @data.to_s(2)
Upvotes: 1
Reputation: 5489
try
bin_num = @data.to_s(2) if @data.class == Fixnum or return results
Upvotes: 2