Splitting\appending arrays with ruby

For general discussion related FlowStone
Post Reply
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Splitting\appending arrays with ruby

Post by kortezzzz »

This topic started in other post and has been answered by @tulamide, but since I had no luck to write the code correctly, I would love if you ruby gurus please tell me whats wrong. Uploaded a simple schematic that partly works, so all is needed here is a little fix so the whole forum (even the bad coders, like me) would enjoys those must have features.

As you would see, my "split" code cuts the array from the end, not from the beginning, as the green does, so I used simple math to fix it, but I'm sure the whole thing can be done simply in ruby itself.

My "append" code shows an error (although tulamide mentioned that there is no meaning to the array's type, so why?)
Attachments
(split and append arrays).fsm
(772 Bytes) Downloaded 887 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Splitting\appending arrays with ruby

Post by tulamide »

Read the error message. You're trying to convert nil to a string. Nil means, there is no object, and I hope you'll agree that you can't convert a big hole of nothing into a string ;)
Attachments
(split and append arrays)[tula].fsm
(625 Bytes) Downloaded 931 times
"There lies the dog buried" (German saying translated literally)
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Splitting\appending arrays with ruby

Post by kortezzzz »

Thanks for the fix, tulamide. the concepts now work :)
Post Reply