Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xquery if then statement issue

I am trying this code on MarkLogic console and getting this error

Unexpected token syntax error, unexpected If_

Here is the code

let $name1 := "Bob"
let $name2 := "John"

if(fn:contains($name1, "Bo")) then
 return "Bob is good"
else 
 return "John is good"
like image 525
subsoft Avatar asked Aug 01 '26 16:08

subsoft


1 Answers

Your syntax is wrong. Try this-

let $name1 := "Bob"
let $name2 := "John"

return 
  if (fn:contains($name1, "Bo")) then
    "Bob is good"
  else 
    "John is good"
like image 143
bosari Avatar answered Aug 04 '26 19:08

bosari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!