CodeGym
AI Academy
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • Getting to Know Coroutines

    Kotlin SELF
    Level 52, Lesson 0
    We break down the basic motivation for coroutines in Kotlin: how blocking a thread with Thread.sleep differs from suspending a coroutine with delay, what the keyword suspend means (a contract, not a “speed booster”), why the kotlinx.coroutines library and the runBlocking “bridge” are needed, and what mistakes beginners most often make when first encountering asynchrony.
    Available
  • runBlocking in a console main: correct coroutine startup

    Kotlin SELF
    Level 52, Lesson 1
    We break down why you cannot call suspend functions directly from a regular main, how runBlocking works as a “bridge” into the coroutine world, and why it honestly blocks the thread. We add the kotlinx.coroutines dependency, build the right style: one runBlocking at the entry point and a chain of suspend scenarios (for example, runApp), plus a practical example with loading data and generating a report.
    Available
  • suspend and delay vs Thread.sleep — how to “wait properly”

    Kotlin SELF
    Level 52, Lesson 2
    We break down how “waiting” differs in coroutines vs threads: why suspend is a straightforward function contract, how delay works (it suspends a coroutine without blocking the thread), and why Thread . sleep freezes a real thread. We reinforce the difference with a table, a practical pattern (“waiting inside a suspend function”), and a list of common mistakes.
    Available
  • launch and async/await — coroutines “for actions” and “for results”

    Kotlin SELF
    Level 52, Lesson 3
    We’ll break down the two main coroutine builders from kotlinx.coroutines: launch (a coroutine for an action/side effect) and async (a coroutine for a result). We’ll understand what Deferred<T> is, why await() is needed, how not to “break” concurrency with early waiting, where it makes sense to mix launch and async, and which mistakes beginners make most often.
    Available
  • Dispatchers and common mistakes: GlobalScope, await(), blocking

    Kotlin SELF
    Level 52, Lesson 4
    We break down how to choose the right Dispatcher for a coroutine: Dispatchers.Default for CPU computations and Dispatchers.IO for blocking input/output. Separately, we cover frequent issues: using GlobalScope in console applications, forgetting await() on Deferred<T>, and blocking via Thread . sleep ( ... ) instead of the correct delay ( ... ). At the end, there’s a mini-scenario with parallel reports and a decision diagram for “where to run.”
    Available
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym