Lascra Compiler

GitHub Repository






Error!
Welcome to Lascra!

Code File Examples

(declare (name "Hello World!") ) (when flag (say "Hello World!") )
(declare (name "if, elif, and else") ) (when flag (ask "Enter a number") (if (= (value answer) 42) (say "42 is the answer") ) (elif (> (value answer) 100) (say "That number is greater than 100") ) (elif (< (value answer) 0) (say "That number is less than 0") ) (else (say "That number is something else") ) )
(declare (name "Events") ) (define (broadcast MyBroadcast) ) (when flag (say "Green Flag") (clone _myself_) (broadcast MyBroadcast) ) (when clicked (say "Sprite Clicked") ) (when (pressed space) (say "Space Key Pressed") ) (when (received MyBroadcast) (say "Received the broadcast") ) (when clone (say "I'm a clone!") (goto _random_) )
(declare (name "Motion") ) (when flag (goto_xy 0 0) (point_direction 45) (move 20) (change_x -50) (glide_xy 5 0 0) (forever (glide 2 _mouse_) ) )
(declare (name "Data") ) (define (variable counter 0) (list things thing1 thing2 thing3 thing4 thing5 ) ) (when flag (set counter 0) (repeat_until (not (< (variable counter) (size things) ) ) (change counter 1) (say (join (join "Thing " (variable counter) ) (join "in things = " (item (variable counter) things) ) ) ) ) (wait 5) (insert "thing" 3 things) (add "addition" things) (delete 4 things) (replace 5 things "replacement") )
(declare (name "Functions and Procedures") ) (function say_if (Say (string message) if (boolean condition) ) (if (argument condition) (say (argument message) ) ) ) (define (variable counter) ) (procedure countdown (Countdown from (number start) ) (set counter (argument start) ) (repeat_until (= 0 (variable counter) ) (say_for (variable counter) 1) (change counter -1) ) ) (when flag (call countdown 5) (say_for "Press to see the message" 2) (forever (call say_if "Generated with Lascra!" (mouse_down) ) ) )
(declare (name "Pen") ) (when flag (hide) (pen_clear) (pen_color #000000) (pen_set size 10) (pen_set transparency 0) (# Draw Square) (pen_down) (repeat 4 (move 50) (turn_right 90) (pen_change transparency 15) ) (pen_up) )