欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

julia_Julia关键字

程序员文章站 2022-04-27 08:45:21
...

julia

Julia| 关键词 (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也具有一些保留字的集合,其含义是预定义的,因此不能用作标识符名称。

Julia also has some of the set of two words keywords.

Julia(Julia)也有一组两个单词的关键字。

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

这些词不能用作变量名。 考虑示例1

Example 1:

范例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

但是, abstract , mutable , native和type可以用作变量名。 考虑示例2

Example 2:

范例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

参考: Julia关键词

翻译自: https://www.includehelp.com/julia/keywords.aspx

julia