How to run a function in ruby

Multi tool use
Multi tool use


How to run a function in ruby



So, this is already making me feel stupid, but I need the answer. I think I learnt it somewhere but I haven't used ruby in a while so I probably forgot.
I am trying to set an age inside of a function in ruby and then get the age displayed.


def set_age(new_age)
@age = new_age
end

def get_age
@age
end



But how do I get this code to run?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

2D1DCa2W9o,o GlcM49F,YqF 3OpM
wNFNMU4uC qC y nwvNO7BQQwytDfjuAWotppcCIb,b DQ,9 n HH7L6EIl9hcnZbp

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications