# cylinder()

## Example

<figure><img src="https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FVsXuXYFkhMtYB1cTMuzP%2Fcylinder%20simple.PNG?alt=media&#x26;token=5b95ca9f-441d-43bf-a4d5-e87398605f64" alt=""><figcaption></figcaption></figure>

## Syntax

```python
cylinder([radius], [height], [detailX], [detailY], [bottomCap], [topCap])
```

<table><thead><tr><th width="140">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>radius</td><td>radius of the cone</td></tr><tr><td>height</td><td>height of the cone</td></tr><tr><td>bottomCap</td><td>a boolean to specify whether or not the cylinder's bottom should be closed with a cap</td></tr><tr><td>topCap</td><td>a boolean to specify whether or not the cylinder's bottom should be closed with a cap</td></tr></tbody></table>

<details>

<summary>Example Full Code</summary>

```python
def setup():
  createCanvas(300,300, WEBGL)

def draw():
  background(255, 79, 132)
  orbitControl()
  stroke(176, 235, 51)
  fill(112, 88, 255)
  strokeWeight(2)

  r = frameCount
  rotateX(r)
  rotateY(-r)
  rotateZ(r)
  cylinder(100, 150)
```

</details>

<figure><img src="https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2Fo0ref2lzhcTeeYJfy7aK%2Fcylinder%20full%202.gif?alt=media&#x26;token=80e214a9-27fe-4a7d-926a-f07000812cf6" alt=""><figcaption></figcaption></figure>

<details>

<summary>Example Full Code</summary>

```python
def setup():
  createCanvas(300,300, WEBGL)

def draw():
  background(255, 79, 132)
  orbitControl()
  stroke(176, 235, 51)
  fill(112, 88, 255)
  strokeWeight(2)

  r = frameCount
  rotateX(r)
  rotateY(-r)
  rotateZ(r)
  cylinder(100, 150, 16, 16, False)ex
```

</details>

<figure><img src="https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FhbAAkKxbiYa2d7GVrziz%2Fcylinder%20full%20no.gif?alt=media&#x26;token=5a74a5d1-0d99-4dab-8904-45fc52ac4830" alt=""><figcaption></figcaption></figure>

<details>

<summary>Example Full Code</summary>

```python
def setup():
  createCanvas(300,300, WEBGL)

def draw():
  background(255, 79, 132)
  orbitControl()
  stroke(176, 235, 51)
  fill(112, 88, 255)
  strokeWeight(2)

  r = frameCount
  rotateX(r)
  rotateY(-r)
  rotateZ(r)
  cylinder(100, 150, 16, 16, False, False)
```

</details>

<figure><img src="https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FGOoyMeBRa1VKwFC37x03%2Fcylinder%20full%20no%20no.gif?alt=media&#x26;token=7ab73229-7e96-4ddc-848f-96036e46f9d0" alt=""><figcaption></figcaption></figure>

## Description

draws a cylinder with a specified radius and height. A top or bottom cap that closes the cone is drawn by default, and can be removed by setting `topCap` or `bottomCap` to `False`

{% hint style="info" %}
Find these documents helpful? Let the people who made them help your child learn to code at [**Strivemath**](https://www.strivemath.com/)<mark style="color:blue;">**!**</mark>

We'd love to hear your Feedback/Comments [here](https://docs.google.com/forms/d/e/1FAIpQLSeqorBAGTya-YBRI-VFjJxtgQtCz3ucGDI96K96sNyuaGuvdw/viewform?usp=sf_link).
{% endhint %}
