x


if(!something) doesn't work in Boo, why?

When I want to check if something is true or false in an if() statement in JavaScript I just go if(something) or if(!something).

if(!something) doesn't work in Boo apparently, it gives this error: Assets/Code/Boo Creation.boo(9,12): BCE0044: unexpected char: '!'.

What is the proper way to do this in Boo? Thank you.

more ▼

asked Dec 13 '10 at 03:06 PM

Aegon gravatar image

Aegon
47 2 3 7

(comments are locked)
10|3000 characters needed characters left

4 answers: sort voted first

http://boo.codehaus.org/Part+03+-+Flow+Control+-+Conditionals

Would it be if(something != true)??

Not much documentation on the Boo language...

Also, http://boo.codehaus.org/BooManifesto.pdf

Check page 8, their's an example saying: if not __

That might help as well, good luck!

more ▼

answered Dec 13 '10 at 03:19 PM

Justin Warner gravatar image

Justin Warner
6.3k 19 27 65

Also, not going to lie... I'd highly advise not using Boo... It's not documented, barely any users use it, and unless you actually know the language, then it'd be completely pointless to use it... Support is slim... Sorry.

Dec 13 '10 at 03:21 PM Justin Warner

I suppose if(something!=true) would work but I didn't think I'd have to do it that way. I really don't like the "if not something" that Boo uses, but I guess there won't be a language I like everything about. Thanks.

Dec 13 '10 at 03:22 PM Aegon

Sorry, C and Java both have many work arounds to things, and most languages share the same syntax, but are also different, you just have to work with them enough to fully understand it I guess... But oh well, good luck none-the-less.

Dec 13 '10 at 04:07 PM Justin Warner

haha , the only reason I even knew it was a code language (I think) is because I noticed it in the drop down menu's of the script reference site when I was replacing the JS samples for C# :F

Dec 13 '10 at 05:00 PM Proclyon
(comments are locked)
10|3000 characters needed characters left

I'm kind of surprised that no one has really answered this yet...

if not something:
   DoSomething()

I should also add that although there isn't all that much documentation for Boo itself, this shouldn't prove to be too much of a barrier: Boo is a CLI language with Python inspired syntax. Thus, boo behaves like C#, and shares the same API (if with different keywords), while it's syntax is practically identical to Python. If you're interested in using Boo, first learn python (an awesome language in and of itself), and then go to http://boo.codehaus.org to get up to speed on the (few) syntactic differences with python.

The only real impediment with learning boo is the syntax, as mechanically, it's practically identical to C# and UnityScript.

more ▼

answered Mar 07 '11 at 01:48 AM

Xathos gravatar image

Xathos
64 2 2 6

For the record, @Proclyon had came up with this... Though in a more complicated and uncertain fashion.

May 07 '12 at 06:47 PM Cawas
(comments are locked)
10|3000 characters needed characters left

From:http://boo.codehaus.org/Part+06+-+Operators

Logical Not "not a" Only use when a is a boolean value

Never used boo, just googled your question and found it in about 30 seconds. Just wondering, does it work?

more ▼

answered Dec 13 '10 at 03:17 PM

Proclyon gravatar image

Proclyon
1.4k 10 13 32

(comments are locked)
10|3000 characters needed characters left
if not something:
    doStuff()
more ▼

answered May 17 '11 at 06:45 PM

Lacrymology gravatar image

Lacrymology
3 5 5 11

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x240
x70

asked: Dec 13 '10 at 03:06 PM

Seen: 951 times

Last Updated: May 07 '12 at 06:47 PM