Keywords

October 26, 2024 ยท View on GitHub

A list and count of keywords in programming languages. Based on work originally compiled by @leighmcculloch and contributors.

2022 update (WIP): I took the latest versions of several popularity lists and am ensuring the top 10 in all three lists were on this list. There have been some pretty significant changes in the past couple of years, including the addition of some soft or contextual keywords in Python 3 and Java, increasing their keyword counts significantly.

In addition to the above, I migrated CI to GitHub Actions and am working to ensure multiple language versions with different keyword sets are represented.

Languages by keyword

Why does it matter?

The number of keywords in a programming language can be an indication to it's simplicity/complexity, and that can impact the simplicity/complexity of the solutions that developers produce using it. Complex solutions can be more expensive to maintain and difficult to hire for. However, this is dependent on many factors and keyword count is only one; language idioms also play a massive part.

License

Source code in this repository is licensed under the MIT License.

Compiled data in this repository is licensed under the Creative Commons Attribution 4.0 International Public License.

SPDX-License-Identifier: MIT AND CC-BY-4.0

Contribute

Don't see a language here? Please open a pull request adding it!

Keyword List

C (ANSI (C89)) (32 keywords)

autobreakcasechar
constcontinuedefaultdo
doubleelseenumextern
floatforgotoif
intlongregisterreturn
shortsignedsizeofstatic
structswitchtypedefunion
unsignedvoidvolatilewhile

Sources:

http://port70.net/~nsz/c/c89/c89-draft.html#3.1.1

C (C11) (44 keywords)

autobreakcasechar
constcontinuedefaultdo
doubleelseenumextern
floatforgotoif
inlineintlongregister
restrictreturnshortsigned
sizeofstaticstructswitch
typedefunionunsignedvoid
volatilewhile_Alignas_Alignof
_Atomic_Bool_Complex_Generic
_Imaginary_Noreturn_Static_assert_Thread_local

Sources:

https://www.open-std.org/JTC1/SC22/WG14/www/docs/n1570.pdf

C (C17) (44 keywords)

autobreakcasechar
constcontinuedefaultdo
doubleelseenumextern
floatforgotoif
inlineintlongregister
restrictreturnshortsigned
sizeofstaticstructswitch
typedefunionunsignedvoid
volatilewhile_Alignas_Alignof
_Atomic_Bool_Complex_Generic
_Imaginary_Noreturn_Static_assert_Thread_local

Sources:

https://www.open-std.org/JTC1/SC22/WG14/www/docs/n2310.pdf

C (C99) (37 keywords)

autobreakcasechar
constcontinuedefaultdo
doubleelseenumextern
floatforgotoif
inlineintlongregister
restrictreturnshortsigned
sizeofstaticstructswitch
typedefunionunsignedvoid
volatilewhile_Bool_Complex
_Imaginary

Sources:

https://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf

C# (8.0) (107 keywords)

abstractasbasebool
breakbytecasecatch
charcheckedclassconst
continuedecimaldefaultdelegate
dodoubleelseenum
eventexplicitexternfalse
finallyfixedfloatfor
foreachgotoifimplicit
inintinterfaceinternal
islocklongnamespace
newnullobjectoperator
outoverrideparamsprivate
protectedpublicreadonlyref
returnsbytesealedshort
sizeofstackallocstaticstring
structswitchthisthrow
truetrytypeofuint
ulonguncheckedunsafeushort
usingvirtualvoidvolatile
whileaddaliasascending
asyncawaitbydescending
dynamicequalsfromget
globalgroupintojoin
letnameofnotnullon
orderbypartialremoveselect
setunmanagedvaluevar
whenwhereyield

Sources:

https://standards.iso.org/ittf/PubliclyAvailableStandards/c075178_ISO_IEC_23270_2018.zip

C++ (C++03) (74 keywords)

asmautoboolbreak
casecatchcharclass
constconst_castcontinuedefault
deletedodoubledynamic_cast
elseenumexplicitexport
externfalsefloatfor
friendgotoifinline
intlongmutablenamespace
newoperatorprivateprotected
publicregisterreinterpret_castreturn
shortsignedsizeofstatic
static_caststructswitchtemplate
thisthrowtruetry
typedeftypeidtypenameunion
unsignedusingvirtualvoid
volatilewchar_twhileand
and_eqbitandbitorcompl
notnot_eqoror_eq
xorxor_eq

Sources:

http://staff.ustc.edu.cn/~zhuang/cpp/specs/ISO_IEC%2014882%202003.pdf

C++ (C++11) (84 keywords)

alignasalignofasmauto
boolbreakcasecatch
charchar_16tchar_32tclass
constconstexprconst_castcontinue
decltypedefaultdeletedo
doubledynamic_castelseenum
explicitexportexternfalse
floatforfriendgoto
ifinlineintlong
mutablenamespacenewnoexcept
nullptroperatorprivateprotected
publicregisterreinterpret_castreturn
shortsignedsizeofstatic
static_assertstatic_caststructswitch
templatethisthread_localthrow
truetrytypedeftypeid
typenameunionunsignedusing
virtualvoidvolatilewchar_t
whileandand_eqbitand
bitorcomplnotnot_eq
oror_eqxorxor_eq

Sources:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf

C++ (C++14) (84 keywords)

alignasalignofasmauto
boolbreakcasecatch
charchar_16tchar_32tclass
constconstexprconst_castcontinue
decltypedefaultdeletedo
doubledynamic_castelseenum
explicitexportexternfalse
floatforfriendgoto
ifinlineintlong
mutablenamespacenewnoexcept
nullptroperatorprivateprotected
publicregisterreinterpret_castreturn
shortsignedsizeofstatic
static_assertstatic_caststructswitch
templatethisthread_localthrow
truetrytypedeftypeid
typenameunionunsignedusing
virtualvoidvolatilewchar_t
whileandand_eqbitand
bitorcomplnotnot_eq
oror_eqxorxor_eq

Sources:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf

C++ (C++17) (84 keywords)

alignasalignofasmauto
boolbreakcasecatch
charchar16_tchar32_tclass
constconstexprconst_castcontinue
decltypedefaultdeletedo
doubledynamic_castelseenum
explicitexportexternfalse
floatforfriendgoto
ifinlineintlong
mutablenamespacenewnoexcept
nullptroperatorprivateprotected
publicregisterreinterpret_castreturn
shortsignedsizeofstatic
static_assertstatic_caststructswitch
templatethisthread_localthrow
truetrytypedeftypeid
typenameunionunsignedusing
virtualvoidvolatilewchar_t
whileandand_eqbitand
bitorcomplnotnot_eq
oror_eqxorxor_eq

Sources:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf

C++ (C++20) (92 keywords)

alignasalignofasmauto
boolbreakcasecatch
charchar8_tchar16_tchar32_t
classconceptconstconsteval
constexprconstinitconst_castcontinue
co_awaitco_returnco_yielddecltype
defaultdeletedodouble
dynamic_castelseenumexplicit
exportexternfalsefloat
forfriendgotoif
inlineintlongmutable
namespacenewnoexceptnullptr
operatorprivateprotectedpublic
registerreinterpret_castrequiresreturn
shortsignedsizeofstatic
static_assertstatic_caststructswitch
templatethisthread_localthrow
truetrytypedeftypeid
typenameunionunsignedusing
virtualvoidvolatilewchar_t
whileandand_eqbitand
bitorcomplnotnot_eq
oror_eqxorxor_eq

Sources:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/n4849.pdf

C++ (C++98) (74 keywords)

asmautoboolbreak
casecatchcharclass
constconst_castcontinuedefault
deletedodoubledynamic_cast
elseenumexplicitexport
externfalsefloatfor
friendgotoifinline
intlongmutablenamespace
newoperatorprivateprotected
publicregisterreinterpret_castreturn
shortsignedsizeofstatic
static_caststructswitchtemplate
thisthrowtruetry
typedeftypeidtypenameunion
unsignedusingvirtualvoid
volatilewchar_twhileand
and_eqbitandbitorcompl
notnot_eqoror_eq
xorxor_eq

Sources:

https://www.lirmm.fr/~ducour/Doc-objets/ISO+IEC+14882-1998.pdf

Dart (2.2) (33 keywords)

assertbreakcasecatch
classconstcontinuedefault
doelseenumextends
falsefinalfinallyfor
ifinisnew
nullrethrowreturnsuper
switchthisthrowtrue
tryvarvoidwhile
with

Sources:

https://dart.dev/guides/language/specifications/DartLangSpec-v2.2.pdf

Elixir (1.10) (15 keywords)

truefalsenilwhen
andornotin
fndoendcatch
rescueafterelse

Sources:

https://hexdocs.pm/elixir/syntax-reference.html#reserved-words

Erlang (23) (27 keywords)

afterandandalsoband
beginbnotborbsl
bsrbxorcasecatch
conddivendfun
ifletnotof
ororelsereceiverem
trywhenxor

Sources:

http://erlang.org/doc/reference_manual/introduction.html#reserved-words

Fortran (Fortran 2008) (103 keywords)

abstractallocatableallocateassign
associateasynchronousbackspacebind
blockblock datacallcase
classclosecodimensioncommon
containscontiguouscontinuecritical
cycledatadeallocatedeferred
dimensiondodo concurrentelemental
elseelse ifelsewhereend
endfileendifentryenum
enumeratorequivalenceerror stopexit
extendsexternalfinalflush
forallformatfunctiongeneric
gotoifimplicitimport
includeinquireintentinterface
intrinsiclockmodulenamelist
non_overridablenopassnullifyonly
openoperatoroptionalparameter
passpausepointerprint
privateprocedureprogramprotected
publicpurereadrecursive
resultreturnrewindrewrite
saveselectsequencestop
submodulesubroutinesync allsync images
sync memorytargetthenunlock
usevaluevolatilewait
wherewhilewrite

Sources:

http://fortranwiki.org/fortran/show/Keywords

Go (1.18) (25 keywords)

breakcasechanconst
continuedefaultdeferelse
fallthroughforfuncgo
gotoifimportinterface
mappackagerangereturn
selectstructswitchtype
var

Sources:

https://golang.org/ref/spec#Keywords

Java (SE 11 LTS) (51 keywords)

abstractassertbooleanbreak
bytecasecatchchar
classconstcontinuedefault
dodoubleelseenum
extendsfinalfinallyfloat
forifgotoimplements
importinstanceofintinterface
longnativenewpackage
privateprotectedpublicreturn
shortstaticstrictfpsuper
switchsynchronizedthisthrow
throwstransienttryvoid
volatilewhile_

Sources:

https://docs.oracle.com/javase/specs/jls/se11/html/jls-3.html#jls-3.9

Java (SE 17 LTS) (67 keywords)

abstractassertbooleanbreak
bytecasecatchchar
classconstcontinuedefault
dodoubleelseenum
extendsfinalfinallyfloat
forifgotoimplements
importinstanceofintinterface
longnativenewpackage
privateprotectedpublicreturn
shortstaticstrictfpsuper
switchsynchronizedthisthrow
throwstransienttryvoid
volatilewhile_exports
modulenon-sealedopenopens
permitsprovidesrecordrequires
sealedtotransitiveuses
varwithyield

Sources:

https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.9

JavaScript (1st edition) (35 keywords)

breakcontinuedeleteelse
forfunctionifin
newreturnthistypeof
varvoidwhilewith
casecatchclassconst
debuggerdefaultdoenum
exportextendsfinallyimport
superswitchthrowtry
nulltruefalse

Sources:

https://www.ecma-international.org/wp-content/uploads/ECMA-262_1st_edition_june_1997.pdf

JavaScript (2nd edition) (59 keywords)

breakcontinuedeleteelse
forfunctionifin
newreturnthistypeof
varvoidwhilewith
abstractbooleanbytecase
catchcharclassconst
debuggerdefaultdodouble
enumexportextendsfinal
finallyfloatgotoimplements
importinstanceofintinterface
longnativepackageprivate
protectedpublicshortstatic
superswitchsynchronizedthrow
throwstransienttryvolatile
nulltruefalse

Sources:

https://www.ecma-international.org/wp-content/uploads/ECMA-262_2nd_edition_august_1998.pdf

JavaScript (3rd edition) (59 keywords)

breakcasecatchcontinue
defaultdeletedoelse
finallyforfunctionif
ininstanceofnewreturn
switchthisthrowtry
typeofvarvoidwhile
withabstractbooleanbyte
charclassconstdebugger
doubleenumexportextends
finalfloatgotoimplements
importintinterfacelong
nativepackageprivateprotected
publicshortstaticsuper
synchronizedthrowstransientvolatile
nulltruefalse

Sources:

https://www.ecma-international.org/wp-content/uploads/ECMA-262_3rd_edition_december_1999.pdf

JavaScript (5th edition) (45 keywords)

breakcasecatchcontinue
debuggerdefaultdeletedo
elsefinallyforfunction
ifininstanceofnew
returnswitchthisthrow
trytypeofvarvoid
whilewithclassconst
enumexportextendsimport
superimplementsinterfacelet
packageprivateprotectedpublic
staticyieldnulltrue
false

Sources:

https://www.ecma-international.org/wp-content/uploads/ECMA-262_5th_edition_december_2009.pdf

JavaScript (6th edition) (46 keywords)

breakcasecatchclass
constcontinuedebuggerdefault
deletedoelseexport
extendsfinallyforfunction
ifimportininstanceof
newreturnsuperswitch
thisthrowtrytypeof
varvoidwhilewith
yieldletstaticenum
awaitimplementsinterfacepackage
privateprotectedpublicnull
truefalse

Sources:

https://www.ecma-international.org/wp-content/uploads/ECMA-262_5th_edition_december_2009.pdf

Kotlin (1.4) (79 keywords)

asas?breakclass
continuedoelsefalse
forfunifin
!ininterfaceis!is
nullobjectpackagereturn
superthisthrowtrue
trytypealiastypeofval
varwhenwhileby
catchconstructordelegatedynamic
fieldfilefinallyget
importinitparamproperty
receiversetsetparamwhere
actualabstractannotationcompanion
constcrossinlinedataenum
expectexternalfinalinfix
inlineinnerinternallateinit
noinlineopenoperatorout
overrideprivateprotectedpublic
reifiedsealedsuspendtailrec
varargfieldit

Sources:

https://kotlinlang.org/docs/reference/keyword-reference.html

Lua (5.3) (22 keywords)

andbreakdoelse
elseifendfalsefor
functiongotoifin
localnilnotor
repeatreturnthentrue
untilwhile

Sources:

https://www.lua.org/manual/5.3/manual.html#3.1

MATLAB (R2020a) (20 keywords)

breakcasecatchclassdef
continueelseelseifend
forfunctionglobalif
otherwiseparforpersistentreturn
spmdswitchtrywhile

Sources:

https://www.mathworks.com/help/matlab/ref/iskeyword.html

Objective-C (2.0) (85 keywords)

asmautobreakcase
charconstcontinuedefault
dodoubleelseenum
externfloatforgoto
ifinlineintlong
registerrestrictreturnshort
signedsizeofstaticstruct
switchtypedefunionunsigned
voidvolatilewhile_Bool
_Complex__blockImaginaryid
ClassSELIMPBOOL
nilNilYESNO
selfsuper_cmd__strong
__weak__autoreleasing__unsafe_unretainedoneway
Inoutinoutbycopy
byref@autoreleasepool@interface@implementation
@protocol@end@private@protected
@public@package@try@throw
@catch()@finally@property@synthesize
@dynamic@class@selector()@protocol()
@required@optional@encode@"string"
@synchronized()

Sources:

https://learning.oreilly.com/library/view/learning-objective-c-20/9780321712110/

PHP (7.4) (69 keywords)

__halt_compiler()abstractandarray()
asbreakcallablecase
catchclasscloneconst
continuedeclaredefaultdie()
doechoelseelseif
empty()enddeclareendforendforeach
endifendswitchendwhileeval()
exit()extendsfinalfinally
fnforforeachfunction
globalgotoifimplements
includeinclude_onceinstanceofinsteadof
interfaceisset()list()namespace
neworprintprivate
protectedpublicrequirerequire_once
returnstaticswitchthrow
traittryunset()use
varwhilexoryield
yield from

Sources:

http://php.net/manual/en/reserved.keywords.php

Python 2 (2.7) (31 keywords)

andasassertbreak
classcontinuedefdel
elifelseexceptexec
finallyforfromglobal
ifimportinis
lambdanotorpass
printraisereturntry
whilewithyield

Sources:

https://docs.python.org/2.7/reference/lexical_analysis.html#keywords

Python 3 (3.10) (38 keywords)

FalseNoneTrueand
asassertasyncawait
breakclasscontinuedef
delelifelseexcept
finallyforfromglobal
ifimportinis
lambdanonlocalnotor
passraisereturntry
whilewithyieldmatch
case_

Sources:

https://docs.python.org/3.10/reference/lexical_analysis.html#keywords https://docs.python.org/3.10/reference/lexical_analysis.html#keywords

R (4.0) (21 keywords)

.....1FALSEInf
NANA_character_NA_complex_NA_integer_
NA_real_NaNNULLTRUE
breakelseforfunction
ifinnextrepeat
while

Sources:

https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Reserved-words

Ruby (2.7) (41 keywords)

ENCODINGLINEFILEBEGIN
ENDaliasandbegin
breakcaseclassdef
defined?doelseelsif
endensurefalsefor
ifinmodulenext
nilnotorredo
rescueretryreturnself
superthentrueundef
unlessuntilwhenwhile
yield

Sources:

https://docs.ruby-lang.org/en/2.7.0/keywords_rdoc.html

Rust (1.46) (53 keywords)

asbreakconstcontinue
crateelseenumextern
falsefnforif
implinletloop
matchmodmovemut
pubrefreturnself
Selfstaticstructsuper
traittruetypeunsafe
usewherewhileasync
awaitdynabstractbecome
boxdofinalmacro
overrideprivtypeofunsized
virtualyieldtryunion
'static

Sources:

https://doc.rust-lang.org/grammar.html#keywords

Scala (2.13) (40 keywords)

abstractcasecatchclass
defdoelseextends
falsefinalfinallyfor
forSomeifimplicitimport
lazymacromatchnew
nullobjectoverridepackage
privateprotectedreturnsealed
superthisthrowtrait
trytruetypeval
varwhilewithyield

Sources:

https://scala-lang.org/files/archive/spec/2.13/01-lexical-syntax.html

Swift (5.3) (97 keywords)

associatedtypeclassdeinitenum
extensionfileprivatefuncimport
initinoutinternallet
openoperatorprivateprotocol
publicrethrowsstaticstruct
subscripttypealiasvarbreak
casecontinuedefaultdefer
doelsefallthroughfor
guardifinrepeat
returnswitchwherewhile
asAnycatchfalse
isnilsuperself
Selfthrowthrowstrue
try_#available#colorLiteral
#column#else#elseif#endif
#error#file#filePath#fileLiteral
#function#if#imageLiteral#line
#selector#sourceLocation#warningassociativity
conveniencedynamicdidSetfinal
getinfixindirectlazy
leftmutatingnonenonmutating
optionaloverridepostfixprecedence
prefixProtocolrequiredright
setTypeunownedweak
willSet

Sources:

https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html

Visual Basic (2019) (217 keywords)

AddHandlerAddressOfAliasAnd
AndAlsoAsBooleanByRef
ByteByValCallCase
CatchCBoolCByteCChar
CDateCDblCDecChar
CIntClassCLngCObj
ConstContinueCSByteCShort
CSngCStrCTypeCUInt
CULngCUShortDateDecimal
DeclareDefaultDelegateDim
DirectCastDoDoubleEach
ElseElseIfEndEndIf
EnumEraseErrorEvent
ExitFalseFinallyFor
For EachFriendFunctionGet
GetTypeGetXMLNamespaceGlobalGoSub
GoToHandlesIfIf()
ImplementsImportsInInherits
IntegerInterfaceIsIsNot
LetLibLikeLong
LoopMeModModule
MustInheritMustOverrideMyBaseMyClass
NameOfNamespaceNarrowingNew
NextNotNothingNotInheritable
NotOverridableObjectOfOn
OperatorOptionOptionalOr
OrElseOutOverloadsOverridable
OverridesParamArrayPartialPrivate
PropertyProtectedPublicRaiseEvent
ReadOnlyReDimREMRemoveHandler
ResumeReturnSByteSelect
SetShadowsSharedShort
SingleStaticStepStop
StringStructureSubSyncLock
ThenThrowToTrue
TryTryCastTypeOfUInteger
ULongUShortUsingVariant
WendWhenWhileWidening
WithWithEventsWriteOnlyXor
#Const#Else#ElseIf#End
#If=&&=
**=//=
\=^^=
++=--=
>>>>=<<<<=
AggregateAnsiAssemblyAsync
AutoAwaitBinaryCompare
CustomDistinctEqualsExplicit
FromGroup ByGroup JoinInto
IsFalseIsTrueIteratorJoin
KeyMidOffOrder By
PreserveSkipSkip WhileStrict
TakeTake WhileTextUnicode
UntilWhereYield#ExternalSource
#Region

Sources:

https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/keywords/