I am having an error when using first on a string series, can someone let me know what is wrong with my code ? I am playing with the series feature and see how it works. I am trying to select an option from a drop down list and then select a file from my c: drive . the option selected is "now" and the file name is "new.xls", I pick the first character of "now" and compare with the first character of "new.xls" , so I expect both to yield a true if they are equal. which they are in this case. However it's giving me an error message. the code is below:- rebol [ ] view layout [ k: drop-down "Hello" "Now" "Bre" "You" ; there is a file new.xls in c/test folder button "click me" [ z: request-file/file %/c/test print series? (find/last form z "/" print second (find/last form z "/" print series? k/text print first k/text ;if I choose "now" from the drop-down and new.xls from ;c/test folder, then if I compare the first character ;this should give me a true if (first k/text = second (find/last form z "/")) [ print "true" ] ] ] ** script error: first expected series argument of type: series pair .... ** near: if first k/text = second
Operator precedence is the issue here. Try this Code: if (first k/text ) = second find/last form z "/" [ print "true" ]
This is an issue that bites frequently if you are not alert! See http://en.wikibooks.org/wiki/REBOL_Programming/Programming_in_REBOL#Precedence