# `choose` selects one option.

`choose` is a switch statement that reads. You list the options, and Jev puts a probability on each. The top option is the pick.

## Run it

*Every song gets a pick.*

```
is_a_song="The text is the title of a song by the Beatles."
question="$is_a_song Who sings the lead vocal on it?"
singers=(
  John
  Paul
  George
  Ringo
  "John and Paul duet"
)

cat <<'EOF' |
Come Together
Yesterday
Something
Octopus's Garden
She Loves You
EOF
thinkthen choose "$question" "${singers[@]}" \
  --batch 1 \
  --lines \
  --replay recording
```

*Output*

```
{"input":"Come Together","value":"John"}
{"input":"Yesterday","value":"Paul"}
{"input":"Something","value":"George"}
{"input":"Octopus's Garden","value":"Ringo"}
{"input":"She Loves You","value":"John"}
```

*exit 0: the run finished*

## Change the bar

*Under a bar of 0.5, She Loves You is not sure.*

```
is_a_song="The text is the title of a song by the Beatles."
question="$is_a_song Who sings the lead vocal on it?"
singers=(
  John
  Paul
  George
  Ringo
  "John and Paul duet"
)

cat <<'EOF' |
Come Together
Yesterday
Something
Octopus's Garden
She Loves You
EOF
thinkthen choose "$question" "${singers[@]}" \
  --batch 1 \
  --lines \
  --threshold 0.5 \
  --replay recording
```

*Output*

```
{"input":"Come Together","value":"John"}
{"input":"Yesterday","value":"Paul"}
{"input":"Something","value":"George"}
{"input":"Octopus's Garden","value":"Ringo"}
{"input":"She Loves You","value":null}
```

*exit 0: the run finished*

## The lesson

John and Paul sing She Loves You together. Jev's pick of John does not reach 0.5. The bar turns it into not sure. The four sure picks stay the same, and all four are right.

A bar keeps the sure picks and hands a person the weak one.

On GitHub: [github.com/botassembly/beatles-bench/tree/main/examples/choose](https://github.com/botassembly/beatles-bench/tree/main/examples/choose)
