How to reset an incremental value used in an if statement?
-
-
Why didn't you post the code snippet inside a 'code' block?
It means we have to retype everything !!
Anyway... after you have the
@fix += @jmp1
add something like this after the 'while...end'
` if @fix >= 432
@fix = 60do other stuff ???
end`
or whatever you like......
Only posting a selection is somewhat useless...
-
#default intermediate column placement @fix = @flenx/2-@fcol if not @fix startfix = @fix if ... # @fix gets changed here end @fix = startfix # a new if statement here -
thanks 2 both if u
if @fix >=@flenx/2-@fcol @fix = @flenx/2-@fcol endfixed the issue

-
@tomot said:
thanks 2 both if u
if @fix >=@flenx/2-@fcol > @fix = @flenx/2-@fcol > endfixed the issue

?
So what you really asked for was how to ensure a maximum value?
-
@thomthom said:
@tomot said:
thanks 2 both if u
if @fix >=@flenx/2-@fcol > > @fix = @flenx/2-@fcol > > endfixed the issue

?
So what you really asked for was how to ensure a maximum value?
NO! ...the original value @fix = 60 just happened to be the result of 2 user selected variables, @flenx & @fcol. When the "while..end" loop finished the value of @fix = 432 I now needed to reset @fix back to its original user selected value.
I had been looking in the API, thinking there might be a 'reset' comment
-
My solution is more readable. Let me rewrite it, thus:
#default intermediate column placement resetfix =( @fix ? @fix ; @flenx/2-@fcol ) if ... # @fix gets changed here end @fix = resetfix # a new if statement; if ... # @fix gets changed again ... end @fix = resetfix # ANOTHER if statement that may change @fix;
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement
