Skip to content

Instantly share code, notes, and snippets.

@exelotl
Created January 27, 2019 20:45
Show Gist options
  • Save exelotl/a9d1c75012e4287bf9598c084fd7eef5 to your computer and use it in GitHub Desktop.
Save exelotl/a9d1c75012e4287bf9598c084fd7eef5 to your computer and use it in GitHub Desktop.
type Point = object
x, y: int
var p = Point(x:100, y:200)
let y = 12 # outer variable should be masked by field y
with p:
echo(x, ",", y) # expected output: 100,200
let x = 5 # inner variable should mask field x
echo(x, ",", y) # expected output: 5,200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment