Types
MyanScript supports several data types, all using Burmese syntax.
Integer
အသက် သည် ၂၅။
Assigns the integer ၂၅ to the variable အသက်
.
Float
အလေးချိန် သည် ၅.၅။
Assigns the float ၅.၅ to အလေးချိန်
.
String
အမည် သည် "မောင်မောင်"။
Assigns the string "မောင်မောင်" to အမည်
.
Boolean
အောင်မြင်မှု သည် အမှန်။
Assigns the boolean true to အောင်မြင်မှု
. Use အမှန်
(true) and အမှား
(false).
Array
Array values in Myst can be any valid expression, including:
- String, Integer, Float, Boolean, Array, Hash
- Infix expressions (e.g., ၁ + ၂)
- Call expressions (e.g., function calls)
TIP
Note: Use the Burmese comma ၊
as a separator between elements, not the English comma ,
.
Examples:
နာမည်များ သည် ["မောင်မောင်"၊ "အေးအေး"၊ "ထွန်းထွန်း"]
အရေအတွက်များ သည် [၁၊ ၂၊ ၃ * ၄၊ ၅ + ၆]
အဖြေများ သည် [နှစ်ဆ(၃)၊ ၁ + ၂၊ ဗလာ၊ [၁၊ ၂]၊ {"key": "value"}]
All of the above are valid arrays with different types of expressions as elements.
Array Index Expression
You can access array elements using index expressions. The index itself can be any valid expression that evaluates to an integer.
TIP
If the index is out of bounds, the result will be ဗလာ
(null).
Examples:
ထုတ်ပြ(နာမည်များ[၁]) // output => "အေးအေး"
အညွှန်း = ၂ - ၁
ထုတ်ပြ(နာမည်များ[အညွှန်း]) // output => "အေးအေး"
ထုတ်ပြ(အရေအတွက်များ[၁ + ၂]) // output => ၁၂
ထုတ်ပြ(နာမည်များ[၅]) // output => ဗလာ (because index ၅ does not exist)
Hash
Hashes (dictionaries) also use the Burmese comma ၊
to separate key-value pairs.
Key Restrictions:
- Hash keys can only be Integer, String, or Boolean values.
- Values can be any valid expression (including functions, arrays, other hashes, etc.).
Example:
လူ သည် {
"အမည်": "မောင်မောင်"၊
"အသက်": ၂၅၊
အမှန်: "true"၊
၁: "ပထမဆုံး"
}။
Hash Index Expressions
You can access hash values using index expressions, similar to arrays. If the key does not exist, it returns ဗလာ
(null).
Examples:
လူ သည် {
"အမည်": "မောင်မောင်"၊
"အသက်": ၂၅၊
}။
ထုတ်ပြ(လူ["အမည်"]) // output => "မောင်မောင်"
ထုတ်ပြ(လူ["အသက်"]) // output => ၂၅
ထုတ်ပြ(လူ["မရှိ"]) // output => ဗလာ (because key doesn't exist)
You can also use expressions as keys:
အညွှန်း = "အမည်"
ထုတ်ပြ(လူ[အညွှန်း]) // output => "မောင်မောင်"
Null
Myst uses ဗလာ
to represent a null or empty value.
Example:
အလုပ် = ဗလာ
This assigns a null value to the variable အလုပ်
.