Ruby variable types and variable scope

Explore the available variable data types in the Ruby programming language and see the differences in variable scope. This is a key tutorial in learning about Ruby since variable scoping issues can lead to code bugs that are difficult to find. Go through the full guide: http://rails.devcamp.com/ruby-programming/ruby-variables/variable-scope-and-variable-types-in-ruby

Comments

TheB10K says:

This is not accurate. Instance variables are available to all methods of that instance of the class. How you described @jobs would only be true for a local variable. Try it yourself: https://repl.it/repls/ClutteredUnconsciousTench

Jennifer Rosse Hamm says:

Well explained!

Thomas Minnick says:

Great video

ripperx444 says:

I don’t understand Ruby syntax for :set_job vs @set_job and why only: has the “:” on the other side.

Python

Class Test:
Def __init__(self, name):
Self.name = name
def printName(self):
print(self.name)

In Ruby you can’t even access name unless you have a getter and setter or the shorthand which kinda makes me wonder why even code in this language. It’s almost like it’s trying to be like Java and a Python hybrid.

The other thing Ruby does oddly is essentially static variables that get mutated via inheritance for all classes. It was a little strange as i dont see the use case for having it.

Overall amazing tutorial for someone trying to come from Java and Python to Ruby(not by choice lol) but hey you gotta do what you gotta do!

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles   Show Cars   Motorbikes   Scooters   Bicycles   Rims & Tires   Luxury BoatsFashion   Sunglasses   Luxury Watches   Luxury Purses   Jeans Wear   High Heels   Kinis Swimwear   Perfumes   Jewellery   Cosmetics   Shaving Helpers   Fashion Hats   Modeling TipsFooding   Chef Club   Fooding Helpers   Coktails & LiquorsSports   Sport Shoes   Fitness & Detox   Golf Gear   Racquets   Hiking & Trek Gear   Diving Equipment   Ski Gear   Snowboards   Surf Boards   Rollers & SkatesEntertainment   DIY Guides   Zik Instruments   Published Books   Music Albums   Cine Movies   Trading Helpers   Make Money   Fishing Equipment   Paintball Supplies   Trading Card Games   Telescopes   Knives   Vapes   GameplaysHigh Tech   Flat Screens   Tech Devices   Camera Lenses   Audio HiFi   Printers   USB Devices   PC Hardware   Network Gear   Cloud Servers   Software Helpers   Programmer Helpers   Mobile Apps   Hearing AidsHome   Home Furniture   Home Appliances   Tools Workshop   Beddings   Floor Layings   Barbecues   Aquarium Gear   Safe Boxes   Office Supplies   Security Locks   Cleaning ProductsKids   Baby Strollers   Child Car Seats   Remote ControlledTravel   Luggages & Bags   Airlines Seats   Hotel Rooms   Fun Trips   Cruise Ships   Mexico Tours