julia 编程语言_Julia编程语言中的变量

julia 编程语言

Julia中的变量 (Variables in Julia)

Just like other programming languages, in Julia variables are the name of memory blocks that are associated (or bound) to a value. It is useful when a value to be stored or to be accessed in/from memory locations.

就像其他编程语言一样,在Julia中,变量是与值关联(或绑定)的内存块的名称。 在存储位置或从存储位置访问或存储值时很有用。

声明变量的规则 (Rules to declare a variable)

  • A variable name must be started with:

    变量名称必须以以下内容开头:

    • a letter (A to Z/a to z), or
    • an underscore (_), or
    • a subset of Unicode code points greater than 00A0
  • A variable name must not contain any special character (exception some of the character in special cases).

    变量名不得包含任何特殊字符(特殊情况下某些字符除外)。

  • Digits (0-9) can be used in the variable name (not as a starting letter)

    可以在变量名称中使用数字(0-9)(不能用作起始字母)

变量命名约定 (Variable naming conventions)

For a better programming style in Julia, we should remember the following points,

为了使用Julia更好的编程风格,我们应该记住以下几点,

  • Variable names should be in lowercase

    变量名应小写

  • Instead of using space as a word separator in variable names, we should use underscore (_).

    不要使用空格作为变量名称中的单词分隔符,而应使用下划线(_)。

  • Types names and Modules names should be started with a capital letter (uppercase), if the variable name is long (used multiple words) then for word separation, we should not use underscore (-), instead of using underscore (_) use the first letter as capital (uppercase) of each word.

    类型名称和模块名称应以大写字母开头(大写),如果变量名称很长(使用多个单词),则为了进行单词分隔,我们不应使用下划线(-),而应使用下划线(_)使用第一个字母作为每个单词的大写(大写)。

  • Functions and macros names should be in lowercase without word separation.

    函数和宏的名称应为小写字母,且不要单词分隔。

声明变量并赋值 (Declaring a variable and Assigning values)

Since Julia does not support data type with the global variables, the variable automatically detects its type based on the given values.

由于Julia不支持全局变量的数据类型,因此变量会根据给定的值自动检测其类型。

Example:

例:

# variables
a = 10
b = 10.23
c = 'c'
d = "Hello"
# printing the values
println("Initial values...")
println("a: ", a)
println("b: ", b)
println("c: ", c)
println("d: ", d)
# updating the values 
a = a + 10
b = b + 12
c = 'x'
d = "world!"
# printing the values
println("After updating...")
println("a: ", a)
println("b: ", b)
println("c: ", c)
println("d: ", d)

Output

输出量

Initial values...
a: 10
b: 10.23
c: c
d: Hello
After updating...
a: 20
b: 22.23
c: x
d: world!

Reference: https://docs.julialang.org

参考: https : //docs.julialang.org

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

julia 编程语言

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/540702.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

php脚本超时 结束执行代码

函数:stream_context_create ,file_get_content 创建并返回一个文本数据流并应用各种选项,可用于fopen(),file_get_contents()等过程的超时设置、代理服务器、请求方式、头信息设置的特殊过程。函数原型:resource stream_context_create ([ a…

c#byte字节流的读取_C#中的byte关键字

c#byte字节流的读取C#字节关键字 (C# byte keyword) In C#, byte is a keyword which is used to declare a variable that can store an unsigned value between 0 to 255. byte keyword is an alias of System.Byte. 在C#中, byte是一个关键…

esp32的GPIO操作

对于任何一款芯片,GPIO接口是其最基本的组成部分,也是一款芯片入门的最基本操作,下面论述下 关于esp32开发版的GPIO操作,本文中重点讲解下 关于如何创建eclipse工程,并通过eclipse下载到esp32中去(本文的工…

c# bool?和bool_C#中的bool关键字

c# bool?和boolC#bool关键字 (C# bool keyword) In C#, bool is a keyword which is used to declare a variable that can store Boolean values true or false. bool keyword is an alias of System.Boolean. 在C#中, bool是一个关键字&am…

聚焦数据的力量——全球领先安全技术分享会在京召开

ZD至顶网安全频道 04月21日 综合消息: 由中国网络安全与信息化产业联盟、360共同主办的“数据的力量——全球领先安全技术分享会“今日在北京成功召开。来自政府、企业、教育、投资机构和产业联盟的300多位嘉宾参加了本次技术分享会,共同就安全产业发展趋…

algol语言_ALGOL的完整形式是什么?

algol语言ALGOL:算法语言 (ALGOL: Algorithmic Language) ALGOL is an abbreviation of "Algorithmic Language". ALGOL是“算法语言”的缩写 。 It is a family of very significant computer programming languages, initially designed and created i…

Qt/QML编程学习之心得:一个.qml文件调用另一个.qml文件(十七)

在c++中,一个文件调用另外一个文件最直接最快捷的方式就是#incldue<头文件>的使用,那么在元数据描述性语言QML中,如何从一个界面描述调用另外一个界面描述,一个.qml文件调用另外一个.qml呢?QML虽然有个import,但是用法可以说完全不同于#include。 引用方法1:直接…

如何设置Fedora默认从命令行启动?

2019独角兽企业重金招聘Python工程师标准>>> Sumary:因为在Fedora中没有/etc/initab文件我们不方便从这里设置它的runlevel target&#xff0c;但是Linux又给我们提供了一个强悍的工具systemd,我们可以用system来链接默认的启动级别&#xff0c;所以开始吧&#xff…

scala 线性回归_Scala的特征线性化

scala 线性回归Scala | 特性线性化 (Scala | Trait Linearization) In Scala programming language, trait linearization is a property that helps to rectify ambiguity when instances of a class that are defined using multiple inheritances from different classes an…

MDK C++中对内联的极度优化

先来看看我们SmartIRQ的具体实现 // 智能IRQ&#xff0c;初始化时备份&#xff0c;销毁时还原 class SmartIRQ { public:force_inline SmartIRQ(bool enable false){_state __get_PRIMASK();if(enable)__enable_irq();else__disable_irq();}force_inline ~SmartIRQ(){__set_P…

python中类怎么理解_Python中的列表理解

python中类怎么理解In order to create a list, a most obvious and remembered solution is to use a for-loop. 为了创建列表&#xff0c;最明显和记住的解决方案是使用for循环。 Example: 例&#xff1a; Python 3.6.8 (default, Apr 25 2019, 21:02:35)[GCC 4.8.5 201506…

工控领域的网络攻击 食尸鬼行动深入解读Operation Ghoul

卡巴斯基于2016年6月监测到了Operation Ghoul&#xff08;食尸鬼行动&#xff09;网络攻击&#xff0c;Operation Ghoul针对30多个国家的工业、制造业和工程管理机构发起了定向渗透入侵。目前&#xff0c;卡巴斯基发现&#xff0c;有130多个机构已被确认为这类攻击的受害者。 该…

julia自然常数_Julia中的Sys.KERNEL常数

julia自然常数Julia| 系统内核常数 (Julia | Sys.KERNEL Constant) Sys.KERNEL is a constant of the Symbol type in Julia programming language, it is used to get the name of the operating system. Sys.KERNEL是Julia编程语言中Symbol类型的常量&#xff0c;用于获取操作…

tomcat:sessionId生成机制导致tomcat启动过慢问题

为什么80%的码农都做不了架构师&#xff1f;>>> http://blog.csdn.net/u013939884/article/details/72860358 转载于:https://my.oschina.net/wii01/blog/1527731

Codeforces Round #431 (Div. 2)

A. Odds and Endstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhere do odds begin, and where do they end? Where does hope emerge, and will they ever break? Given an integer sequence a1, a2, ..., a…

ping/pong模式_PING的完整形式是什么?

ping/pong模式PING&#xff1a;数据包InterNet Groper (PING: Packet InterNet Groper) In the sector of networking of computers, PING is an abbreviation of Packet InterNet Groper. It is utility software or system software of administration of computer network u…

Gartner: 2017年11大信息安全技术(解读版)

在2017年6月份举办的第23届Gartner安全与风险管理峰会上&#xff0c;Gartner的Fellow——Neil McDonald发布了2017年度的11个最新最酷的信息安全技术&#xff0c;比往年的10大技术多了一项。以往都是通过互联网了解Gartner的各种信息和报告。这次&#xff0c;本人有幸亲临现场&…

博客url什么形式_URL的完整形式是什么?

博客url什么形式URL&#xff1a;统一资源定位符 (URL: Uniform Resource Locator) URL is an abbreviation of Uniform Resource Locator. Uniform Resource Locator which is informally or casually known as a web address is addressed as a resource of the web, which ca…

Verizon的SDN策略:不鸣则已,一鸣惊人?

Verizon对于其网络虚拟化计划的进展等一直保持缄默&#xff0c;但这并不代表Verizon没在SDN方面投入。 Verizon于2015年推出了初步的SDN迁移计划&#xff0c;但并未就此事对外界做过多披露。与此同时&#xff0c;它影响着它的SDN虚拟化合作伙伴。如电缆方面&#xff0c;据介绍&…

宝马奥迪工厂模式_宝马的完整形式是什么?

宝马奥迪工厂模式宝马&#xff1a;巴伐利亚汽车公司 (BMW: Bayerische Motoren Werke) BMW is an abbreviation of "Bayerische Motoren Werke". It is a multinational automobile and motorcycle manufacturing company whose headquarter is situated in Munich, …