1. Home
  2. Docs
  3. General Programming
  4. Multi Threading

Multi Threading

Multi threading allows us to perform several actions at the same time. Lets have a look at this sample code:


Sinbad is a model
david is a Sinbad
david.Dance
david.rotate(y+360) in 5 seconds

Running this code will show us the Sinbad model dancing and then rotating 360 degrees.
In order to perform the dancing at the same time of the rotation we need to put the async keyword after the david.Dance command. Let’s have a look at the modified program:


Sinbad is a model
david is a Sinbad
david.Dance async
david.rotate(y+360) in 5 seconds

That’s it. The async keyword tells the computer that david.Dance command should not block the next command so now david Dance and Rotate are happening at the same time.

Was this article helpful to you? Yes No

How can we help?