HaxeFoundation / haxe.org-comments

Repository to collect comments of our haxe.org websites
2 stars 2 forks source link

[haxe.org/manual] Using enums #53

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

Using enums - Haxe - The Cross-platform Toolkit

Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.

https://haxe.org/manual/types-enum-using.html

shaman4d commented 4 years ago

As the option to get Rgb arguments: trace(Type.enumParameters(color))

FlooferLand commented 4 months ago

It would be cool if there was a way to extract values using if statements, similar to Rust

if (valueThing == MyEnum.Percentage(percent) && percent != 0) { .. }
Gulvan0 commented 3 months ago

@FlooferLand See this macro: https://code.haxe.org/category/macros/extract-enum-value.html