Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] What does "loop" return?

From: valeri:mytinski:g:mail at: 4-Apr-2009 22:38

Hi! I am novice in REBOL - 4 days learning, although 20 years in programming. My question is: what does "loop" ("foreach" and so on) return? Namely:
>> r: loop 2 [append [] 3]
== [3 3]
>> help r
R is a block of value: [3 3]
>> r: loop 2 [3]
== 3
>> help r
R is an integer of value: 3 In first case "loop" returns block (seems like ...?) while in second it returns integer (seems like last evaluated value). So there are some questions: - is that desirable ? - what is the sense of such behaviour ? - why only second case is described in REBOL/Core doc ? (and for REBOL 3 too) - if I am wrong and in first case "loop" returns value too then how this value (block [3 3]) is calculated ? Thanks in advance. I can't go ahead without understanding base things. Valeri