Created
November 30, 2014 19:26
-
-
Save brycefisher/48233996d47ee3a05e00 to your computer and use it in GitHub Desktop.
Namespaced Enums
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enum syntax has changed. | |
// Given this enum: | |
enum Shapes { | |
Circle, | |
Square | |
} | |
// WORKS | |
let drawing = Shapes::Circle; | |
// BROKEN: | |
let drawing = Circle; | |
// You can make this work by adding a `use Shapes::Circle;` to the top of the file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment