'Netlogo: "expected a literal value" in a "ifelse" block

I want to check if the turtle is a sheep or wolf, and set commands seperately. But Netlogo highlights the set and tells me

expected a literal value

Here is edited code, I added more basic information and did some simplification for quick understanding.

breed [sheep a-sheep]
breed [wolves wolf]


sheep-own [SEnergy]
wolves-own [WEnergy]

to setup
  clear-all
  create-sheep 100
  ask sheep [set SEnergy 100]
  
  create-wolves 100
  ask wolves [set SEnergy 100]
  
  reset-ticks
end

to go
  ask turtles[
    (ifelse
      is-a-sheep? [set SEnergy SEnergy - 1]
      is-wolf? [set WEnergy WEnergy - 1])
  ]
  tick
end

I've red the example in Netlogo dictionary

(ifelse boolean1 [ commands1 ] boolean2 [ commands2 ] ... [ elsecommands ])

Thus I think [set SEnergy SEnergy - 1] in my code is expected a command. Why Netlogo tells me a literal value is needed?

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source