5.仓颉编程_数组使用与异常捕捉
数字数组与字符串数组
import std.console.*
main() {
var qty = 10
var zero2 = 0
var array = [1,2,3] //数组
var str_arr:Array<String> = ['aa','bb']
try {
//qty = qty / zero2
//println(qty)
println(str_arr[0])
println(array[0])
// println(array[5])
} catch (e: Exception) {
println("error message:" + e.message)
}
try
{
throw NegativeArraySizeException("Exception test!")
}
catch(e:NegativeArraySizeException)
{
println(e)
}
}
交流咨询请评论区留下邮箱