[REBOL] dumb problem!! Re:

1999-11-22 Thread assembly

On Sun, 21 Nov 1999 [EMAIL PROTECTED] wrote:

  if [ a = 0 ] [ 
print [ "this is true "]
  return true
  ]; end if
 

My bad I had my head in C for the moment. remove the braces around if [ a
= 0] so it looks like if a = 0 [ print "this is true" ]

If you need to make it clearer for yourself then group items like this

if (a = 0) [

that will work properly because otherwise if [ a = 0] just creates a block
a = 0

And since it is successful at creating a block it will automaticly return
true.

or you could also technicly do if do [a = 0] [ print "this is true"] but
thats a bit excessive.

and a cleaner way of writing your function would be.

arbit: func [] [
print :a
either :a = 0 [
print ["This is true"]
return true ; Although not needed because either will return true
][
print ["False"]
return false
]
]



[REBOL] dumb problem!! Re:

1999-11-22 Thread assembly

On Sun, 21 Nov 1999 [EMAIL PROTECTED] wrote:

 i know i am shit in programming !!!
 and this is a very dumb problem.. but i cant see the mistake sorry!!!
 whats wrong???
  if [ a = 0 ] [ 
print [ "this is true "]

This is common with people that arent familiar with programming languages. 

In the beiginning you assign the value of a to be 100

But at the if statement you are reassigning the value of a to be 0 so it
evaluates true automaticly.

replace if[a = 0] with if[a== 0]

FLA



[REBOL] dumb problem!! Re:

1999-11-20 Thread larry

Hi Subhra

Put the test in parens like this:

if (a = 0) [etc. ..

Larry

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, November 20, 1999 1:47 PM
Subject: [REBOL] dumb problem!!


 i know i am shit in programming !!!
 and this is a very dumb problem.. but i cant see the mistake sorry!!!
 whats wrong???
 
 
 a: 100
 arbit: func [] [
  print  a
  if [ a = 0 ] [ 
  print [ "this is true "]
  return true
  ]; end if
 
 print "this is false"
return false 
 ]
 
 
 emp: arbit
 print emp
 
 ***
 this is the answer i get ..
 
 **
 100
 this is true
 true
 *
 
 i am fed up.. pl. dont flame me up this time