julia_Julia关键字

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值