Draycos Goldaryn
Member
and
Example:
Syntax:
First evaluates the left side; if the result is true, evaluates the right side. and does the same as &&, but is a lower priority operator.
or
Example:
Syntax:
First evaluates the left side; if the result is false, evaluates the right side. or does the same as ||, but is a lower priority operator.
Example:
Code:
test && set
test and set
Code:
expr '&&' expr
expr and expr
or
Example:
Code:
demo || die
demo or die
Code:
expr '||' expr
expr or expr
Ok, so With that said, would the following be true?
and
first evaluates the left side; if the result is false, it does not evaluate the right side.
or
First evaluates the left side; if the result is true, it does not evaluate the right side.
first evaluates the left side; if the result is false, it does not evaluate the right side.
or
First evaluates the left side; if the result is true, it does not evaluate the right side.
Say, for example, I do not want to overwrite a method that may have already been defined but i want to define it if it hasn't already. I use this code:
Code:
unless Object.const_defined?(:Class) and Class.method_defined?(:method)
class Class
def method
#do this
end
end
else
class Class
alias old_method method
def method
#do this
old_method
end
end
end
What I want to know is: if Class has not been defined, will it still try to check if method has been defined? If it did, that would throw an error, wouldn't it?