Q&A's, tips, howto's
-
dexter
- Posts: 74
- Joined: Fri Nov 11, 2011 12:55 am
Post
by dexter »
just say
Code: Select all
(setq test 0)
(if (= test 0) (begin (println test) (++ test)) (= test 1) (begin (println test)))
and this output as :
Code: Select all
> (if (= test 0) (begin (println test) (++ test)) (= test 1) (begin (println test)))
0
1
Is it different to C ?
Cause I thought (if ) only run once, so the output should be one line , a 0
new lisp can not do it ?
-
HPW
- Posts: 1390
- Joined: Thu Sep 26, 2002 9:15 am
- Location: Germany
-
Contact:
Post
by HPW »
Code: Select all
(silent(setq test 0))
(silent(if (= test 0) (begin (println test) (++ test)) (= test 1) (begin (println test))))
The 1 you see is the return value.
Hans-Peter
-
dexter
- Posts: 74
- Joined: Fri Nov 11, 2011 12:55 am
Post
by dexter »
Thanks
I never noticed (silent)