if语句具有2个条件和2个不同长度的字符串数组. [英] if statement with 2 condition and 2 different length string array.
本文介绍了if语句具有2个条件和2个不同长度的字符串数组.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尊敬的先生,
1.如果条件为2的语句
2. 2个不同长度的字符串数组.
例如.
Dear sir,
1. if statement with 2 condition
2. 2 different length of string array.
ex.
string[] str={"Hai","welcome","To","Code","Project"};
string[] str2={"By","Mohan","Kumar"}
str.length=5;
str2.length=3;
okey.
okey.
if(int i=0;i<str.length||i><str.length;i++)>
{
//code here.
}
我想要结果,
循环5次,但是str2无法为最后2个索引分配空值.
通过mohan
i wantresult,
loop 5 times repeat but str2 cant assign null values last 2 index.
By mohan
推荐答案
如果数组的大小为3,则必须先扩展数组才能引用第4和第5个元素.
为简单起见,我建议您使用列表 [
If the size of the array is 3 you cannot refer to 4th and 5th elements without first extending the array.
For simplicity, I''d suggest that you would use List[^] instead of an array. Adding, deleting etc. would be much more easier.
这篇关于if语句具有2个条件和2个不同长度的字符串数组.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文