1. Home
  2. /
  3. Crystal
  4. /
  5. Max of Two Numbers

Max of Two Numbers - Crystal Typing CST Test

Loading…

Max of Two Numbers — Crystal Code

Finds the maximum of two numbers.

def max(a, b)
	a > b ? a : b
end

puts max(10, 20)

Crystal Language Guide

Crystal is a modern, statically typed, compiled programming language with syntax heavily inspired by Ruby. It aims to combine the efficiency and speed of compiled languages with the readability and productivity of Ruby, supporting type inference, concurrency, and high-performance applications.

Primary Use Cases

  • ▸Web applications (via Kemal, Amber frameworks)
  • ▸Command-line tools
  • ▸Microservices and APIs
  • ▸High-performance backend services
  • ▸System utilities and scripting
  • ▸Prototyping with production-ready performance

Notable Features

  • ▸Ruby-inspired readable syntax
  • ▸Static type system with inference
  • ▸Compiled to fast native binaries
  • ▸Macros and compile-time code generation
  • ▸Concurrency via fibers and channels

Origin & Creator

Crystal was created by Ary Borenszweig, Juan Wajnerman, and Brian Cardiff in 2011, inspired by Ruby’s syntax and modern systems programming needs.

Industrial Note

Crystal is used in web backend frameworks, DevOps tooling, microservices, and performance-critical tasks where Ruby-like syntax with compiled efficiency is desirable.

More Crystal Typing Exercises

Crystal Counter and Theme ToggleCrystal Simple AdditionCrystal FactorialCrystal Fibonacci SequenceCrystal List SumCrystal Even Numbers FilterCrystal Conditional Counter IncrementCrystal Resettable CounterCrystal Theme Toggle Only

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher