Two days ago I did the Over the Air (OTA) update for my new Hyundai Electric Kona 2023. It was weird so see how much changed (many of the changes not listed at all on the update documentation) but either they altered how the power-steering works or the update turned power steering off. They car is a lot harder to drive now, and it feels like a different car (one which I would not have bought). So while the radio became much better, the danger of OTA updates is that now you may change the profile of the car so much it's a different product.
In this Rails project I'm running I need to set a whole bunch of individual variables to 'disabled' at once depending on the group the current user belongs to. We can use multiple assignment in this case but with a caveat. Multiple assignments are a quick way of setting a lot of variables at once. h, k = 1,2 => [1,2] h => 1 k => 2 but h, k = 1 => 1 h => 1 k => nil In that case we can do this: h = k = 1 => 1 h => 1 h => 1 Beware this sets them to the same object. So if you change one you change both. h = k = [] h << 1 h => [1] k => [1] While we're at it here is how to reverse two variables: h = 1 k = 2 h,k = k,h h => 2 k => 1
Comments
Post a Comment