Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

enum

enum UserResponse {
  No = 0,
  Yes = 1,
}

function respond(recipient: string, message: UserResponse): void {
  console.log(recipient, message); // "Princess Caroline",  1
}

respond("Princess Caroline", UserResponse.Yes);
Source by www.typescriptlang.org #
 
PREVIOUS NEXT
Tagged: #enum
ADD COMMENT
Topic
Name
1+1 =