85

When I want to comment code about control Enable/Disable and when I want to discuss with people about the control Enable/Disable, I really hope there is actually a word to it instead of typing or saying "Enable/Disable".

Currently I use the word EnDisable, what is the real word of it?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Led
  • 1,021
  • 1
  • 8
  • 11
  • If you mean controls, the common names are "ghost out" and "grey out" – SF. Mar 30 '10 at 10:46
  • 1
    In the context of writing a function or reporting a status: `SetEnabled` or `IsEnabled`. – Nicholas Miller Apr 21 '16 at 20:03
  • This is not a question about programming! Maybe try https://english.stackexchange.com/ instead. – U. Windl Nov 25 '21 at 00:42
  • @U.Windl wouldn't Nomenclature be covered in programming; is not it extremely important (to standardize/add meaningful words to) the language which explains the code – Danish ALI Nov 24 '22 at 00:46
  • @NicholasMiller: maybe your comment would justify an answer in this context, because it’s concise in function naming an also works with a “toggle” boolean. – dakab Jun 14 '23 at 09:15

7 Answers7

100

I would suggest using "toggle" as although it doesn't exactly mean Enable/Disable it is commonly used as such in the context of user interfaces (as @Pekka mentioned).

Yacoby
  • 54,544
  • 15
  • 116
  • 120
  • 4
    I know this is old as hell but toggle typically describes turning something off/on, not controlling whether or not the control can be manipulated. – GhostBytes Dec 16 '20 at 17:21
17

I use "Ability", because if something is "enabled", it is "able to", and if it's "disabled" it is "unable to", so "ability" works for me and it's quite understandable. To switch the parameter I name my function "setAbility".

Wojtek
  • 171
  • 1
  • 3
  • I've settled on "Ability" myself, and I've found that there are times when it feels right to combine it with @Yacoby's answer and use "AbilityToggle". – Granger Mar 24 '23 at 21:07
13

Really depends on the context.

  • Changing of a control's status?
  • Switch?
  • Change?

Update: @Yacoby has the perfect one, it's widely used in user interface contexts.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • "Change status" is exactly what I was looking for, since the code in question doesn't necessarily toggle between on/off – codehearts Jul 27 '17 at 15:53
4

If I'm writing functions that enable or disable something depending some other data, I usually call them "ToggleXXX".

Oliver Friedrich
  • 9,018
  • 9
  • 42
  • 48
2

Depends on the context. If you are referring to a life-support system, 'Kill' probably.

Rob Kent
  • 5,183
  • 4
  • 33
  • 54
1

Conditional is another option.

Artemious
  • 1,980
  • 1
  • 20
  • 31
1

Depending on the context, but I would suggest Behavior if talking about whether something is enabled or disabled by default.

Other words like action, toggle, or condition can also work depending on the context

R41313IT
  • 11
  • 4