Home »
Julia
Julia keywords
Julia | Keywords: In this tutorial, we are going to learn about the keywords in Julia programming language, list of the keywords in Julia.
Submitted by IncludeHelp, on March 30, 2020
Julia | Keywords
Like other programming languages, Julia also has the set of some reserved words whose meanings are the predefined and They cannot be used as the identifiers name.
Julia also has some of the set of two words keywords.
The keywords are:
baremodule, begin, break, catch, const,
continue, do, else, elseif, end,
export, false, finally, for, function,
global, if, import, let, local,
macro, module, quote, return, struct,
true, try, using, while
These words cannot be used a variable name. Consider the example 1
Example 1:
# example to demonstrate that
# keywords cannot be used as a variable name
a = 10
else = 20
println("a: ", a)
println("else: ", else)
Output
ERROR: LoadError: syntax: unexpected "else"
However, abstract, mutable, primitive and type can be used as a variable name. Consider the example 2
Example 2:
# some keywords from two words keywords
# can be used as a variable name
a = 10
abstract = 20
mutable = 30
primitive = 40
type = 50
println("a: ", a)
println("abstract: ", abstract)
println("mutable: ", mutable)
println("primitive: ", primitive)
println("type: ", type)
Output
a: 10
abstract: 20
mutable: 30
primitive: 40
type: 50
Reference: Julia Keywords