The complete, free course

Learn Salam

This course covers the whole language, from your first program to the advanced parts, in short lessons that build on each other. Every lesson has complete programs with the output they actually produce; copy them and run them in the online editor.

Getting started

  1. 1Your first programThe entry point, running a program, printing output, exit codes, input, comments and the shape of a program
  2. 2Variables and constantsDeclaring with :=, mutable variables, scope, globals, constants and naming rules
  3. 3TypesWhole and decimal numbers, overflow, booleans, characters, mixing types and conversion
  4. 4OperatorsArithmetic, division and remainder, powers, comparison, logic, the ternary, compound assignment, bitwise flags and precedence
  5. 5Strings and textString literals and escapes, joining text, bytes and characters, the str package, comparing text and reading numbers from text

Control flow

  1. 6Conditionsif, else if and else, comparison words, and and or, early returns, comparing floats and the rules a condition follows
  2. 7Loopsrepeat with a count, a range and a step, the until loop and its traps, loops that end with break, each over arrays, vectors, maps and strings, nested loops, break N and continue
  3. 8match and switchChoosing between cases with match and switch: values, strings, enums, data and guards, struct patterns, fallthrough and switch inside loops

Functions

  1. 9FunctionsDeclaring and calling functions, early return, default values, several results with tuples, recursion, overloads, reference parameters and main's exit code
  2. 10Anonymous functionsFunctions as values: anonymous functions, the function type, sorting with a comparator, functions that return functions and what a lambda captures
  3. 11defer and function modifiersRunning cleanup at the end of a block with defer, in what order and when, plus the pure, inline, noinline, noret and deprecated modifiers

Data and types

  1. 12Arrays and slicesArrays, indexing, arrays of a given size, searching and totals, two dimensional arrays, copies and slices that write through
  2. 13Vector and HashMapGrowable lists with Vector, key and value pairs with HashMap, sorting, and Set, Stack and Queue
  3. 14StructsRelated data together, methods and this, pub and private, printing, copying, static members and embedding
  4. 15EnumsA closed set of cases, chosen values, enums in structs, enums that carry data, generic enums, and keeping a result as a value
  5. 16New types and operatorsType aliases, distinct types with their own methods and operators, operator overloading in structs, and or types
  6. 17Generics and interfacesGeneric functions and containers, interfaces, impl, bounds and dyn collections

Larger programs

  1. 18Packages and filesPackages, include and import, pub and privacy, folder packages and project layout
  2. 19What the compiler insists onThe strict rules of Salam, the error code for each, and how to fix them
  3. 20Values, references and memoryCopies and sharing, copy and deep_copy, freeing memory, who frees a string, pointers and memcheck
  4. 21Conditional compilationCode for each operating system and processor, build flags with -D, and debug-only checks, all decided while compiling
  5. 22Working with CCalling C functions with extern, printf and other variadic functions, pointers and buffers, linking libraries, and handing Salam functions to C
  6. 23ConcurrencyThreads with spawn and join, sharing data safely, channels and parallel loops

Web pages

  1. 24The layout languageBuilding web pages with layout: elements, attributes, styles, click handlers, components, layouts with parameters, and serving them from a Salam program
  2. 25Pages and textThe shape of a page, headings, paragraphs, line breaks and every text level element: emphasis, quotes, code, edits, dates, abbreviations and mixed direction text
  3. 26Page structure and listsLandmarks such as header, nav, main and footer, then lists, definition lists, details, dialogs, figures and addresses, and how to build a whole blog page from them
  4. 27Links, images and mediaLinks and anchors, images with alt text and responsive sources, image maps, audio and video with subtitles, frames, embeds, canvas, SVG and math
  5. 28TablesTables for data: caption, header, body and footer sections, heading cells with scope, spanning cells, column groups, and how to style and scroll a table
  6. 29FormsForms and every form control: labels, all the input types, validation, text areas, checkboxes, radio buttons, lists, buttons, output, progress and meters, files, and handling a submit in code
  7. 30Head, scripts and global attributesThe settings of the page, the head with meta and links, styles and scripts, templates and shadow trees, the attributes every element has, ARIA, data attributes and splitting a site into files
  8. 31Styles and the box modelCSS from zero: style properties as attributes, values, units and colors, the box model, sizes, margins, display, overflow, CSS functions, global rules and reusable components
  9. 32Fonts and text stylingFont families and sizes, weights, web fonts, variable fonts, alignment, decoration, spacing, wrapping, text direction, vertical text, ruby and Persian typography, with every font and text property
  10. 33Colors, backgrounds and effectsText and background colors, opacity, layered backgrounds, gradients, fitting images, filters, blend modes, masks, clip paths and text that wraps around a shape
  11. 34Borders, outlines and shadowsThe border shorthand and every side, logical sides, rounded corners, border images, outlines and focus rings, box shadows, broken boxes and the new corner shapes
  12. 35Layout: flow, flex and gridNormal flow, position and z index, float, flexbox, grid, alignment, multi-column text and right-to-left pages, with every layout property and an example for each
  13. 36Responsive pages and statesPages that fit every screen: fluid sizes, media and container queries, dark mode, hover, focus and generated content, pointer, scrolling and print properties
  14. 37Transitions and animationsMotion on a page: transitions, transforms and 3D, keyframe animations, motion paths, scroll driven animations, view transitions and respecting reduced motion
  15. 38The rest of CSSLists and counters, quotation marks, table settings, scroll snapping and scroll margins, anchor positioning, SVG fill and stroke, math, reading order and the other properties not covered before
  16. 39Mouse eventsMaking a page react to the mouse: handlers, click, double click, other buttons, the context menu, pointer position, drawing, enter and leave, bubbling and the wheel
  17. 40Keyboard and formsKeys, focus, typing, text selection, form submit, reset and validation, the clipboard, details, popovers and dialogs: the events of every part of a page that people type into
  18. 41Drag, touch, scroll and windowDrag and drop between lists, pointer and touch events, scroll and window events, and the load, error and abort events of images
  19. 42Media, animation and other eventsAudio and video events, a custom player, animation and transition events, slot changes, captions, canvas context loss and security policy violations
  20. 43State, the DOM and timersHow the pieces of an interactive page fit: state in variables, reading and changing elements, classes and styles, creating and removing elements, timers, storage, dialogs, components with handlers and how to debug
  21. 44Whole pages: six projectsSix complete pages that bring the lessons together: a landing page, a blog post with a sidebar, a sign up form with live checks, a dashboard with a CSS bar chart, a task list that remembers, and a photo gallery with a lightbox, plus how a Salam program serves a page

Reference

  1. 45The English and Persian glossaryEvery Salam keyword, type, built-in function, built-in method and compile-time constant in both languages
  2. 46Best practicesCheck the standard library first, then design with structs, enums, interfaces and generics, keep functions small, and split a program into files

Server and deployment

  1. 47The salam serve web server: from one folder to many domainsA complete guide to salam serve: serving a folder, writing the config file, virtual hosts, several domains and subdomains, PHP through php-fpm, Python and Go, using it from Salam itself, HTTPS and deployment

This course is about the language itself. For the standard library (files, text, numbers, networking and the rest) see the library reference.