r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

alemar
18-Jan-2011
[4078x4]
trying to compile the code now but the compiler from the site is 
a bit tricky
** Script error: n has no value
** Where: while
** Near: while [i <= n] [sum: sum + probe (i * i) i: i + 1]
:D
ok is the Near error a syntax error in the cycle?
Maxim
18-Jan-2011
[4082]
the main difference in REBOL is that everything you can manipulate 
is a value, even functions and objects don't have a special syntax 
to use... they are values just like anything else.
Henrik
18-Jan-2011
[4083]
there is no compiler...
Maxim
18-Jan-2011
[4084]
hehehe... if you paste it directly in the console, the ask will intepret 
the next line as the answer  ;-)
alemar
18-Jan-2011
[4085]
then what am i using :D
Pekr
18-Jan-2011
[4086]
:-)
Maxim
18-Jan-2011
[4087]
so it triggers an error and n is never assigned any value  ;-)
alemar
18-Jan-2011
[4088]
yeah exctly i understood that
Pekr
18-Jan-2011
[4089]
alemar - rebol is an interpreter ...
Maxim
18-Jan-2011
[4090]
for the console, just replace the first line by 

n: 5
alemar
18-Jan-2011
[4091x2]
ok so where do you input the code(script)?
omg i am so wrthless
Maxim
18-Jan-2011
[4093]
or you can make a function out of it.... right in the console.
alemar
18-Jan-2011
[4094x3]
ok so i am not doing this right
i am wrong at the verry beginning
so first things first
Henrik
18-Jan-2011
[4097]
the console is for one-line inputs, if you want to type in your code 
directly. that interactive use of REBOL.


the way you want to do this, is create a script in notepad, and run 
the script from the REBOL console
alemar
18-Jan-2011
[4098x2]
how do i input the code as a whole in the interpreter
ahaa
Henrik
18-Jan-2011
[4100]
try this:
alemar
18-Jan-2011
[4101]
does the script have any particular extension?
Maxim
18-Jan-2011
[4102]
my-func: func [] [
	n: to-integer ask "enter a number"
	if  n < 0  [quit/return 1]
	sum: 0
	i: 0
	while [ i <= n ] [ sum: sum + probe (i * i)  i: i + 1]
	print sum
]
Henrik
18-Jan-2011
[4103]
REBOL []

; right click this text area to copy the text

print "hello!"
Maxim
18-Jan-2011
[4104]
then just:

my-func
Henrik
18-Jan-2011
[4105x2]
save it as test.r
open a REBOL console and type:

do %/path/to/test.r
alemar
18-Jan-2011
[4107x3]
ok i get ** access error: missing port scheme: C
do C:\Users\alemar\Downloads\test.r
this what i typed in
Maxim
18-Jan-2011
[4110x2]
rebol has its own path datatype...
so it would be 
do %/C/users/alemar/download/test.r
alemar
18-Jan-2011
[4112]
haha thank you so much for your patience guys
Maxim
18-Jan-2011
[4113]
the % character before a string of text identifies the whole string 
as a file path...

ex:

>> type? %/C/users/alemar/download/test.r 
== file!
alemar
18-Jan-2011
[4114x3]
i really appreceate thet i just need to get this script running so 
i can grasp the basics
ok please don`t hate me i got this:
>> do %/C/users/alemar/download/test.r

** Access error: cannot open: %/C/users/alemar/download/test.r reason: 
-3
** Where: read either read-decode case load -apply- do

** Near: read source if find system/options/file-types type [data: 
de...
Henrik
18-Jan-2011
[4117]
alemar, is your console a black DOS like console?
alemar
18-Jan-2011
[4118]
yes
Henrik
18-Jan-2011
[4119]
ok, you are using REBOL 3. I suggest using REBOL 2 for now, as REBOL 
3's console is currently rather hard to use.
alemar
18-Jan-2011
[4120x2]
rebol3 alpha to be exact
ok
Henrik
18-Jan-2011
[4122]
there won't be much difference at your learning level
alemar
18-Jan-2011
[4123x3]
thanks
at the downloads the only version 2 is REBOL/View 2.7 for Graphical 
Applications
will that do?
Maxim
18-Jan-2011
[4126]
yep.
alemar
18-Jan-2011
[4127]
?