价值更新问题 [英] value updateing problem

查看:95
本文介绍了价值更新问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取值n进行更新,但由于某些原因它将无法工作.代码< g class ="gr_ gr_18 gr-alert gr_tiny gr_spell gr_run_anim ContextualSpelling multiReplace" data-gr-id ="18". id ="18" i/g.有 到目前为止

I am trying to get the value n to update but it will not work for some reason. The code <g class="gr_ gr_18 gr-alert gr_tiny gr_spell gr_run_anim ContextualSpelling multiReplace" data-gr-id="18" id="18">i</g> have so far os

推荐答案

if条件后面的代码块需要运行多次以增加n的值(您也可以使用'n ++ ;而不是'n = n +1;').是这样吗?您的代码段没有显示该内容.

The code block behind your if condition needs to run for multiple times to increment the value of n (you could also use 'n++;' instead of 'n = n + 1;').  Is that the case? Your snippet doesn't show that.

而且,您的变量n一定不能成为单独的线程(例如,在方法中声明的变量)的一部分,该线程在if条件再次得到评估(并且n得到递增)之前已经完成,否则可能会被垃圾回收.你在哪里申报 变量n?

And, your variable n must not be part of a separate thread (e.g. a variable declared in a method) that gets finished before the if condition gets once more evaluated (and n gets incremented), otherwise it might get garbishcollected. Where do you declare the variable n?

希望


这篇关于价值更新问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆