无法弄清楚如何在多行上声明一个字符串数组 [英] Can't figure out how to declare a string array on multiple lines
本文介绍了无法弄清楚如何在多行上声明一个字符串数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这段代码在运行时导致错误,但会编译.
This code was causing errors at runtime but would compile.
Local $acceptable[] = ["Chrome",_
"Firefox",_
"IE"]
如果我将它全部移动到一行上,它会起作用.但是,我想声明很多元素.如何在多行中正确声明它?
It works if I move it all on one line. However, I want to declare many elements. How do I correctly declare it over multiple lines?
推荐答案
根据 语言参考 - 评论(强调):
虽然每行只允许一个语句,但如果将下划线_
"前面有一个空格放在一个长语句的末尾,则一个长语句可以跨越多行折线.字符串定义不能分成多行,需要使用串联.
Although only one statement per line is allowed, a long statement can span multiple lines if an underscore "
_
" preceded by a blank is placed at the end of a "broken" line. String definition cannot be split in several lines, concatenation need to be used.
示例(每个下划线前的空格):
Example (space before each underscore):
#include <Array.au3>
Global Const $g_aAcceptable[] = ["Chrome", _
"Firefox", _
"IE"]
_ArrayDisplay($g_aAcceptable)
这篇关于无法弄清楚如何在多行上声明一个字符串数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文