I recently saw this function in a program I am studying. The global, check is set to equal one:
s=snew(s_old, beta,alpha,dt)
global check
s=s_old+dt*alpha/(1+dt*alpha*beta);
if(check)
chsnew=(s-s_old)/dt-(s-(alpha-(1-s)-beta*s);
end
I don't understand the if(check) sequence. Can someone explain?
The global variable "check" can be set to 1 or 0 in order to enter or not in the "if" statement.
The same can be done for example when you are debugging code and want to execute some instructions in this context:
debug=1;
if (debug)
<code to execute when debugging>
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.