if. You can see that
. An expression inside
()is evaluated (e.g.
a: ( 1 + 2) a; 3) and an expression inside
is not evaluated (not sure if this is proper term). So you should use
()for grouping code to run it immediately. You should use
to pass some code/data.
true. It should be "true-thy value" or something like this.
view [ b: button extra 'a [probe get in get face/extra 'text] a: area "this is an area text" ]
@9214 A simple "" made me crazy....
I have a bunch of dynamically created buttons
Their face/data content refer to dynamically created areas objects
foreach [tag name] buttons [ keep compose [ (to set-word! name) area 300x50 (copy "") wrap ] ]
The function executed when I hit one of the buttons pass the face/data, which is <areaname> ,and then I print <areaname>/text....
I always had the same printed result despite the button I hit....
Four hours to discover that tiny "" had to be changed to (copy "") !
Does anyone knows the Logo? You can play with it here.
I want to mimic Logo's functionality. What I need is to keep a) current pen position and b) rotation.
shape sub-dialect keeps pen position but it does not know about rotation. I have found out that I can rotate over some point (
rotate <degree> <point>). However I am rotating using values computed by me. Here is an example. I want to draw square.
The Logo code:
; just so we can start as Red's shape right 90 forward 40 right 90 forward 40 right 90 forward 40 right 90 forward 40
and here is the Red's code:
view [base 300x300 red draw [ shape [ move 100x100 ] shape [ 'line 40x0 ] rotate 90 140x100 shape ['line 40x0] rotate 90 180x100 shape ['line 40x0 ] rotate 90 220x100 shape ['line 40x0 ] ] ]
Is there some function or word that keeps current pen position? I want to use it like
rotate 90 _pen-position_ instead of hard-coded
rotate 90 220x100.
view [ style small: area 30x30 button button button return button button button return area below small small small ]
<center>parameter ( (optional) center of rotation (pair!)) doesn't matter. We should calculate
<center>parameter other way.