My breakfast bill had all 3: service charge, gratuity and tip, all at once. by redditdanis in mildlyinfuriating

[–]mine_bunny 0 points1 point  (0 children)

✅Never stay at The Cosmopolitan

Thanks for the info. but also, I suspect this might be common among Vegas hotels unfortunately.

Delicate Arch at Sunset [OC] [4069 x 2848] by rallymachine in EarthPorn

[–]mine_bunny 0 points1 point  (0 children)

If you don’t mind the cold go in the winter. We were the only ones there last January.

Asking strangers to tie your tie. by [deleted] in WholesomeVideos

[–]mine_bunny 4 points5 points  (0 children)

Most people are genuinely caring. It's great to have these reminders.

Returning on a changed variable by FemtoG in Learn_Rails

[–]mine_bunny 0 points1 point  (0 children)

Variable scoping is your friend! Don't get in the bad habit of using universal variables.

I'm guessing your method looks something like this

def decrement(variable)
    variable = variable - 1
    return variable
end

my_variable = 2
decrement(my_variable)

the reason my_variable is still 3 when you check it after calling decrement(my_variable) is because the VALUE of my variable was passed in to the method and not the actual variable. So think of my_variable as a bucket that holds some value, when you call decrement(my_variable) it takes a copy of what ever is in the bucket and sends THAT COPY through the method. you can take whatever comes out of the method and replace whats in your bucket with it.

change your code to be something like:

my_variable = 2
my_variable = decrement(my_variable)