Jump to content

Recommended Posts

Posted
(- botLength 6000)

If this value is a minus value , I need to set it zero. Please help

Posted

You mean like this?

(if (minusp botLength) 0 (- botLength 6000))

 

  • Like 1
  • Thanks 1
Posted
(if (= (minusp botLength) T) ;; verifies that a number is negative
	
    (setq botLength 0) ;; if it is, it will set to 0
    
    (setq botLength (- botLength 6000)) ;; if it isn't, it will be substracted with "6000"
    
    )

 

  • Like 1
  • Thanks 1
Posted

If (- botLength 6000) is minus....

 

(if (= (minusp (- botlength 6000)) T) ;; verifies that a number is negative
  (setq botLength 0)                  ;; if it is, it will set to 0
  (setq botLength (- botLength 6000)) ;; if it isn't, it will be substracted with "6000"
) ;;End If

 

  • Like 1
Posted
12 minutes ago, Steven P said:

If (- botLength 6000) is minus....

 

(if (= (minusp (- botlength 6000)) T) ;; verifies that a number is negative
  (setq botLength 0)                  ;; if it is, it will set to 0
  (setq botLength (- botLength 6000)) ;; if it isn't, it will be substracted with "6000"
) ;;End If

 

 

Just another example, nice, also it would work.

Posted
(if (minusp (- botLength 6000))
  (setq botLength 6000)
)

 

  • Like 1
Posted

Why get fancy?

 

(max 0 (- botLength 6000))

 

  • Like 2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...