Boolean affectation shortcut


#1

Hello here !

I wonder why I can’t use these statements :
new_image? = (filesize > 0)

or even

new_image? = (filesize > 0 ? true : false)

Thanks


#2

Hi,

You can’ t because only methods can end with ?, but you are using it
like a variable.
Looks, like you need to rethink your programs design.

Maybe something like this:

class Image

def new_image?
filesize > 0
end

end


Martins