Skip to content

Compile-Time switch-case Generation #2079

Answered by lerno
tikoko23 asked this question in Q&A
Discussion options

You must be logged in to vote

You can use @enum_from_value:

fn KeyboardKey? keyFromKeycode(uint key_code) @local 
{
   return @enum_from_value(KeyboardKey, code, key_code);
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tikoko23
Comment options

@lerno
Comment options

Answer selected by tikoko23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants