I have code that deleted multiple variables, as such...
session.delete(:a)
session.delete(:b)
session.delete(:c)
session.delete(:d)
is it possible to delete them all in one go instead of 4 lines?
It is possible. Check out one way using basic Array#each
method:
[:a, :b, :c, :d].each { |x| session.delete(x) }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With