I have the following function:
def price
if super == nil
return 'super'
end
super
end
nil is being returned. How is this possible? Should the if statement catch super if it equals nil and then return ‘super’
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If
supercan return different values each time, this is possible (if unlikely). Perhaps try the following? It only callssuperonce, so it doesn’t have that pitfall.