Skip to content

Instantly share code, notes, and snippets.

@3014zhangshuo
Created December 28, 2018 08:12
Show Gist options
  • Save 3014zhangshuo/82b81ad7d6427ec2605c2efaefa575a8 to your computer and use it in GitHub Desktop.
Save 3014zhangshuo/82b81ad7d6427ec2605c2efaefa575a8 to your computer and use it in GitHub Desktop.
ruby code simulate javascript var keyword assign value
def var(_);end
var name = "z"
@3014zhangshuo
Copy link
Author

3014zhangshuo commented Dec 28, 2018

Just like a visual magic, var name = "z" you can split two parts, left part var is a method, right part name = "z" as a argument of the var method, the argument will return "z" and set local variables name in current binding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment