Wednesday 19 April 2017

The 'Red' Console


Working in the Red Console

    Click on this to make it bigger !


------------------------------------------------------------


You can cut and paste these examples.

Let's start with the usual 'Hello World'

print "Hello World !"

s: "I am Jenny"
print s

prin s

probe s
------------------------------------------------------------

Now use the ? to get help


? print
? prin
? probe
------------------------------------------------------------

Type 'what' at the prompt to get a description of all functions.


what
-----------------------------------------------------------

Variables


name: "Jenny"
print name

num: 36
print num
-----------------------------------------------------------

Assign a block of code to a variable and run it with 'do'

mydo: [print "Hello World"]
do mydo
-------------------------------------------------------------

What about an  'if then'  block

n: 5
if n < 6 [print "Less than 6"]
-------------------------------------------------------------

And an 'either'  true  and  false block 

s: "Yes"
either s = "Yes" [print "It's Yes"] [Print "It's not Yes"]
-------------------------------------------------------------

Using random with the either block

n: random 6
either n < 4 [print "Less than 4"] [print "More than 3"]
-----------------------------------------------------------

ask for input

nm: ask "enter name: "

----------------------------------------------------------

display the contents of current folder

dir
---------------------------------------------------------

display the current folder

print ["Current folder:" get-current-dir]

---------------------------------------------------------

Try these:

request-dir
request-file
request-font



More soon!

------------------------------------------------------------

No comments:

Post a Comment