title: How to get "only the x-coordinate" of a randomly selected turtle from the turtles that exist in a straight line on the x-axis?
body: <p>How do I get only the x-coordinate of a randomly selected turtle from the turtles that exist in a straight line on the x-axis and make it a variable?
  For example, here's a sample code, but it doesn't work.</p>
  
  <pre><code>  globals [x-only]
    ;omitted
    ask one-of turtles with [xcor &lt; max-pxcor and  pycor &lt; 1 and pycor &gt; -1][
     set x-only list xcor ycor  ;I might be wrong here, but there are no good syntax.
     move-to patch x-only 1
    ]
    ;omitted
  </code></pre>