Message 1 of 10
My first practice program

Not applicable
04-04-2015
03:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi!
I got my self an Autolisp book since year 1998 to start learining it.
And they give quite good examples and practice tasks.
So i'm trying to do my first practice task.
The idea is to get the last word of a string by using while looping and counting functions.
So i was thinking t count words backwards, but it didnät work aout. Can anybody give me ideas so i can try myself 🙂
Here is my beginning code...
(defun c:lastword (/ N1 txt lastword) (setq N1 0 txt "My first program") (while (>(strlen txt) N1) ( setq N1 (1+ N1)) ) (setq strlength (strlen txt)) (setq lastword (substr txt strlength N1 )) (princ lastword) )