什么数据对象允许限制变量中的可能值?

时间:2018-04-27 18:28:57

标签: data-structures

我记得在这方面学习了一些最佳实践,但我完全清楚了这个名称。基本上,而不是说:

pencil_1.size = 'SHORT';
pencil_2.size = 'LONG';
pencil_3.size = 'SHORT';
pencil_4.size = 'SHORT';
pencil_5.size = 'MEDIUM';

我们会说:

pencil_1.size = Length.SHORT;
pencil_2.size = Length.LONG;
pencil_3.size = Length.SHORT;
pencil_4.size = Length.SHORT;
pencil_5.size = Length.MEDIUM;

1 个答案:

答案 0 :(得分:0)

我刚刚找到答案:Enum。这就是我一直在寻找的术语。