M
Michael Brooks
Hello everyone:
Why can't I name boolean variables with a "?" on the end? The "?" can
be used on the end of methods but not variable. Here is an example:
# This naming convention works with "?"
def boolean_method?
return true
end
puts boolean_method?
# This naming convention doesn't works with "?"
boolean_variable? = true
puts boolean_variable?
The question mark would make the intention of the variable obvious, just
like it helps the method name.
So why isn't this allowed? Did I miss something?
Thank You,
Michael
Why can't I name boolean variables with a "?" on the end? The "?" can
be used on the end of methods but not variable. Here is an example:
# This naming convention works with "?"
def boolean_method?
return true
end
puts boolean_method?
# This naming convention doesn't works with "?"
boolean_variable? = true
puts boolean_variable?
The question mark would make the intention of the variable obvious, just
like it helps the method name.
So why isn't this allowed? Did I miss something?
Thank You,
Michael