trouble with or

S

shawn bright

hello there,
i am having a problem with a simple thing.

i have this ( trying to divide up a list into three more or less equal columns )
i += 1
if i == @sites.length / 3.to_i
or i == (@sites.length / 3).to_i * 2

i am getting a lot of unexpected kOR exceptions.

what am i doing wrong ?

thanks

sk
 
D

Dan Zwell

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

shawn said:
hello there,
i am having a problem with a simple thing.

i have this ( trying to divide up a list into three more or less equal
columns )
i += 1
if i == @sites.length / 3.to_i
or i == (@sites.length / 3).to_i * 2

i am getting a lot of unexpected kOR exceptions.

what am i doing wrong ?

thanks

sk

Your problem is that "if i == @sites.length / 3.to_i" is a complete
idea, so ruby doesn't know the line is supposed to continue. You can
either add a backslash at the end of the first line, or bring "or" up a
line:

if i == @sites.length / 3.to_i or
i == (@sites.length / 3).to_i * 2

Dan Zwell
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGIRwLUYnvW+YuEvYRAqUqAKCReYaovyyDqV+IyvTNtAnvS87rjACeJafM
q7lpVZrz5kZU9CrEvI3zgug=
=bVKA
-----END PGP SIGNATURE-----
 
S

shawn bright

oh, ok, i get it, thanks much gents!
sk

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Your problem is that "if i == @sites.length / 3.to_i" is a complete
idea, so ruby doesn't know the line is supposed to continue. You can
either add a backslash at the end of the first line, or bring "or" up a
line:

if i == @sites.length / 3.to_i or
i == (@sites.length / 3).to_i * 2

Dan Zwell
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGIRwLUYnvW+YuEvYRAqUqAKCReYaovyyDqV+IyvTNtAnvS87rjACeJafM
q7lpVZrz5kZU9CrEvI3zgug=
=bVKA
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,240
Messages
2,571,208
Members
47,845
Latest member
vojosay

Latest Threads

Top