日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發(fā)布時(shí)間:2025/3/11 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 julia 编程语言_Julia编程语言中的变量 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

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中,變量是與值關(guān)聯(lián)(或綁定)的內(nèi)存塊的名稱。 在存儲(chǔ)位置或從存儲(chǔ)位置訪問或存儲(chǔ)值時(shí)很有用。

聲明變量的規(guī)則 (Rules to declare a variable)

  • A variable name must be started with:

    變量名稱必須以以下內(nèi)容開頭:

    • 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)

    可以在變量名稱中使用數(shù)字(0-9)(不能用作起始字母)

變量命名約定 (Variable naming conventions)

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

為了使用Julia更好的編程風(fēng)格,我們應(yīng)該記住以下幾點(diǎn),

  • Variable names should be in lowercase

    變量名應(yīng)小寫

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

    不要使用空格作為變量名稱中的單詞分隔符,而應(yīng)使用下劃線(_)。

  • 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.

    類型名稱和模塊名稱應(yīng)以大寫字母開頭(大寫),如果變量名稱很長(使用多個(gè)單詞),則為了進(jìn)行單詞分隔,我們不應(yīng)使用下劃線(-),而應(yīng)使用下劃線(_)使用第一個(gè)字母作為每個(gè)單詞的大寫(大寫)。

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

    函數(shù)和宏的名稱應(yīng)為小寫字母,且不要單詞分隔。

聲明變量并賦值 (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不支持全局變量的數(shù)據(jù)類型,因此變量會(huì)根據(jù)給定的值自動(dòng)檢測(cè)其類型。

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 編程語言

總結(jié)

以上是生活随笔為你收集整理的julia 编程语言_Julia编程语言中的变量的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。