プレイ日記
Ed CPFace
Are you tired of typing out long and repetitive statements to keep your values in-bounds, like: IF X‹0 THEN X=0 IF X>50 THEN X=50 Here are some quick functions to make the process simpler.
7そうだね
プレイ済み
返信[1]
親投稿
Ed CPFace
X=HIGH(0,X) will force X up to 0 if it's too low. X=LOW(50,X) will force X down to 50 if it's too high. X=BOUNDS(X,0,50) will force X to stay within the bounds of 0-50 by forcing it up to zero if it's too low or down to 50 if it's too high.
1そうだね
プレイ済み
返信[2]
親投稿
calc84 calc84maniac
Not to rain on your parade, but there are built-in functions MAX and MIN that are the equivalent of HIGH and LOW. But on the other hand, I think your HIGH and LOW functions will work on strings while the built-in functions don't, and the BOUNDS function is useful either way!
0そうだね
プレイ済み
返信[3]
親投稿
Ed CPFace
Ah! I guess I didn't read enough into MIN and MAX; I thought they only worked with arrays.
0そうだね
プレイ済み
返信[4]
親投稿
Ed CPFace
Here's the shorter BOUNDS function. And it's still worth keeping MIN and MAX in mind for your bounds-checking.
0そうだね
プレイ済み