Arnob Arnob - 1 year ago 62
Ruby Question

Why I'm getting void value expression although I have assigned value

I am new into ruby. I have the following code block:

a = 10

while a < 20 do
puts "True"

next unless a == 12
puts "This is not 12"


However, I'm getting void value expression for
a ==12
.I have assigned 10 into it to begin with so I don't see why I'm getting void value.

Answer Source

replace a++ by a += 1 should work.

Ruby has no ++ operator. No increment operator (++) in Ruby?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download