本文介绍了如何在循环中保存该值(用于)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从其他变量获取值时出现问题.绝对是不同的变量,但显示相同的值. 这是我的代码
I have a problem when get a value from different variable. It''s definitely different variable but it shown a same value. This my code
for k =1 to 10 If RC <= 10 Then ortu1 = k JumPar += 1 If JumPar = 2 Then ortu2 = k end if end if next当我从ortu1和ortu2打印值时,它们显示相同的值. 我应该怎么办?我想获取第一个"k"值和第二个"k"值并将其设置在ortu1和ortu2中. 感谢您的帮助
When I print value from ortu1 and ortu2, they show a same value. What should I do? I want to get first ''k'' value and second ''k'' value and set it in ortu1 and ortu2. Thanks for help
推荐答案问题是,每次循环时,您都将ortu1设置为k的值-然后检查是否还应该设置ortu2到k的值. 如果要在一个变量中使用第一个值,而在另一个变量中使用第二个值,则需要对它们都进行测试: The problem is that every time you go round the loop, you set ortu1 to the value of k - and then check if you should also set the value of ortu2 to k. If you want the first value in one variable and the second in another, then you will need to test them both: JumPar = 1; For k = 1 to 10 If RC <= 10 Then If JumPar = 1 Then ortu1 = k; Else If JumPar = 2 Then ortu2 = k; End If JumPar += 1; End If Next
更多推荐
如何在循环中保存该值(用于)?
发布评论