Kotlin
Learn Kotlin by typing concise, idiomatic code.
Practice Kotlin's concise style by typing it: data classes, null safety with ?. and ?:, extension functions, sealed classes, and coroutines for async work. Each snippet is idiomatic Kotlin, and an AI tutor explains every line — how the compiler enforces null safety, when a scope function fits — so you write less boilerplate and type it fluently.
Progress0 / 706 solved · 0/50 sections
best wpm
0
avg wpm
0
accuracy
0%
runs
0
level
1
rating
1000
Run Kotlin on your machine
1. Install the toolchain
brew install kotlin2. Save your code as hello.kt, then compile & run
kotlinc hello.kt -include-runtime -d hello.jar && java -jar hello.jarprogress by section
1Fundamentals0/15start →
2Strings In Depth0/17start →
3Values & References0/15start →
4Slices & Arrays0/17Unlock →
5Data structures0/14Unlock →
6Iterators0/20Unlock →
7Traits0/20Unlock →
Interface + implComparable & sortingComparator with compareByDefault methodsequals and hashCodeOperator: unaryMinusOperator: plusComputed interface propertyInterface propertyOperator: compareToOperator: containsOperator: getOperator: invokeMultiple interfacesOperator: plusAssignOperator: setOperator: timesIterable via iterator()A custom IteratorResolve a default clash
8Generics0/20Unlock →
Type boundGeneric classGeneric functionTwo type parametersGeneric extensionGeneric factoryGeneric interfaceGeneric methodsGeneric newtypeNumber boundGeneric Pair extensionGeneric sealed typeStar projectionwhere clauseContravariance with inGeneric key selectorCovariance with outReified type parameterReified with isUse-site variance
9Lifetimes0/20Unlock →
References aliasDropping a referencelet on a nullablealso for side effectsapply for setupClosures captureCombining scope functionsChaining letrun blocktakeIf as a guardwith on a receiverA custom AutoCloseableA closure factorylazy initializationlazy runs onceClosures mutate capturesuse closes for youuse returns a valueA WeakReferenceClearing a WeakReference
10Closures0/20Unlock →
A lambdaThe implicit itCapturing the environmentExplicit type & block bodyfold takes a lambdaMultiple parametersTrailing lambdaCallbacksClosures drive the chainComparator from a lambdaCapturing in a filterFunction referencesHigher-order argumentCurryingBound & unbound referencesReturning a functionA stateful closuretypealias for a function typeCompose two functionsA list of functions
11Pattern Matching0/20Unlock →
when on valuesDestructure a data classExhaustive over an enumwhen as an expressionDestructure in a loopMatch a nullableComma branchesDestructure a returned Pairwhen with rangesSafe call & elvisDrain with whileThe in operatorType checks with iswhen without a subjectBranch by runtime typeCustom componentNwhen with guardsSealed class exhaustive whenMatch a list's shapeRecursive sealed match
12Error Handling0/20Unlock →
finally always runsthrow an exceptiontry as an expressioncheck for statecheckNotNullResult.getOrElseKeep only the successesonSuccess and onFailurerequire for argumentsrunCatching to a ResultInspect the causeAll-or-nothing parseA custom exceptionException with dataResult.foldmapCatchingSeveral catch blocksrecover from failureuse for cleanupRethrow with a cause
13Option & Result0/20Unlock →
14Conversions0/15Unlock →
15Collection Conversions0/19Unlock →
16Math0/14Unlock →
17Encoding0/22Unlock →
String to bytesChar checks and caseBytes to StringChar to code pointChar digit valueBinary, octal, hexBig-endian bytesList code pointsEscape control charsHex encodeLittle-endian bytesBytes vs charsParse a number in a baseLossy UTF-8 decodeBase64 decodeBase64 encodeCaesar cipherHex decodeROT13URL encodeXOR cipherURL decode
18Random0/20Unlock →
Coin flipPick a random elementRandom number in a rangeSeed from the clockRandom Double in [0, 1)Weighted true/falseRandom bytesShuffle in placeRandom alphanumeric stringRandom enum variantA linear congruential generatorPassword generatorReproducible sequencesSample k without replacementCryptographic randomRandom UUIDAn xorshift generatorRoll many diceWeighted choiceNormal distribution
19Data I/O0/18Unlock →
Parse CSV into rowsTab-separated valuesBuild a CSV stringSelect one columnCSV into a number matrixSplit off the headerWhitespace-separated matrixRead a data fileSerialize records to CSVSkip blanks and commentsPrint an aligned tableWrite CSV to a fileWrite a matrix as textAppend a rowStream lines lazilyParse key=value configRound-trip write then readDrop unparseable rows
20Linear Algebra0/21Unlock →
Matrix shapeScalar multiplyA matrix of zerosElementwise addArgmax of a vectorIdentity matrixOne-hot encodeTraceStack rows (vstack)ReLU and sigmoidApply a function elementwiseColumn meansColumn sumsCosine similarityFlat storage, 2D indexingMatrix times vectorTransposeMatrix multiplyMin-max normalize columnsSoftmaxStandardize columns (z-score)
21Text Processing0/16Unlock →
22Date & Time0/13Unlock →
23Memory0/12Unlock →
24Modules0/20Unlock →
An object namespaceTop-level function as memberConstants in a namespaceAn enum in a namespaceGlob importSeveral importsimport as (alias)Nested objectsPublic vs privateA class in a namespaceReach the enclosing scopeFully-qualified nameCall an object's own memberA small utility namespacePrivate field, public getterFlatten a deep pathAn interface in a namespaceinternal visibilityRe-export a memberReach a sibling namespace
25Macros0/20Unlock →
The apply builderLazy propertiesData class codegenEnum codegenExtension functionsInline functionsDestructuringExtension propertiesInfix functionsOperator overloadingA pseudo-constructorCallable objectsMap-backed propertiesObservable propertiesIndexing operatorsReified type parametersReified type checkAnnotations + reflectionA custom property delegateA tiny type-safe DSL
26Testing0/20Unlock →
A basic equality checkChecking a booleanMultiple checksChecking two values differTesting string outputTesting a truth tableTesting an error caseExpecting an exceptionA shared test helperTesting a throw pathAsserting on a listTesting a methodTesting a nullable resultSkipping a slow testAsserting on the messageComparing floatsTesting a private helperTesting a ResultA tiny test runnerTable-driven tests
27Algorithms0/8Unlock →
28Sorting Algorithms0/12Unlock →
29Expression Parsing0/6Unlock →
30Idioms0/9Unlock →
31OOP & Traits0/8Unlock →
32Trait Objects0/14Unlock →
Take an interfaceDefault over polymorphismSafe cast with as?Enum with abstract methodFactory returns an interfaceA fun interface (SAM)Generic with an interface boundis checks & smart castList of an interfaceA list of functionsA handler registrySealed + when dispatchSum over an interface listwhen as an expression
33Design Patterns0/14Unlock →
34Async0/8Unlock →
35File I/O0/6Unlock →
36Filesystem0/18Unlock →
Does a path exist?Copy a fileFiles vs directoriesList a directoryCreate nested directoriesRename or moveBuild a pathChange the extensionDelete a whole treeFile sizePath componentsSorted listingCreate a temp directoryFilter by extensionLast modified timeWalk with java.nioTotal size of a treeWalk the tree
37Networking0/16Unlock →
38Concurrency0/15Unlock →
39Unsafe & FFI0/14Unlock →
40Commands0/14Unlock →
41Array0/10Unlock →
43String0/10Unlock →
45Interval0/5Unlock →
46Linked List0/6Unlock →
47Tree0/14Unlock →
Maximum Depth of Binary TreeInvert Binary TreeSame TreeLowest Common Ancestor of a BSTBinary Tree Level Order TraversalSubtree of Another TreeImplement Trie (Prefix Tree)Kth Smallest Element in a BSTValidate Binary Search TreeAdd and Search WordConstruct Binary Tree from Preorder and InorderBinary Tree Maximum Path SumSerialize and Deserialize Binary TreeWord Search II