Local Files


    • Getting started

      Weblab notebooks are a great way to code interactively. By running small snippets of code you can directly see their effect. Additionally, Weblab let's you add text or illustrations to your source code. Making it easier to understand your code for yourself and others.

      Every Weblab notebook is a collection of cells which are either

      • code cells or
      • markdown cells.

      Let's learn more about how to use code and markdown cells.


    • Code cells

      Code cells are where the "magic" happens. They evaluate your code. To understand how this works, let's look at an example.



    • The cell contains Javascript code. You can evaluate the cell by pressing "Shift+Enter" or the "Run"-button in the menubar. Weblab will run an interpreter that evaluates the source code inside the cell. It will then print out the result of the last statement of the cell. If you haven't already, give it a try!

      The power of programming comes from using abstractions. We have just learned one powerful way of creating abstractions. The declaration of variables. Variables let you refer to certain expressions by names. Variables persist across cell borders and can be reused in other cells. For example:



    • Another powerful way to create abstractions are functions. A function lets you name a group of operations and then refer to it as a unit. For example:



    • Are you getting an "undefined" when you run the cell? Don't worry, that's the right value of a function declaration. The function was still defined and is ready to be used. Check it out:



    • Variables and functions are a great way to abstract away some complexity while programming. But to be honest you probably don't want to start writing a complex program like a linear algebra framework in weblab. Luckily you don't have to. There are thousands of libraries available in the Javascript ecosystem. You just have to learn how to import them into you project. Importing is done by using the import statement as follows:



    • The Javascript programming language offers a lot more features which cannot all be covered here. If you want to learn more, the javascript reference in the Mozilla Developer Network is a great place to start.


    • Markdown cells

      Markdown cells are "text" cells. They let you write comments, add links or add images. Markdown cells have two modes. An edit and a display mode.

      As the name suggests, the edit mode enables you to edit the content of the cell. You can get into the edit mode of a markdown cell by double clicking it. The idea behind markdown cells is that you write content in the edit mode according to the Markdown syntax and then display the formatted text by switch into the display mode.

      The display mode displays the html that is generated from the markdown source. To switch into the display mode from the edit mode, press "Shift+Enter" or the "Run"-button in the menubar. It's best if you try the whole thing out. Double click on the current cell, edit the content and switch back to the display mode to see the changes.


    • Headings

      One very useful feature of markdown is that you can easily create headings. Just prepend a # before a line and the line becomes a heading. For example:

      # Your heading
      

      By using multiple # you can specify different levels of headings. Using # gives the highest level heading where as using ###### gives the lowest level heading. Have a look at the source of this cell to see that the heading of this cell is a third level heading.


    • Lists

      It is also very easy to create lists of items in markdown. You can use - or * in front of a line to turn it into a list item. For example:

      - apples
      - bananas
      - oranges
      

      becomes

      • apples
      • bananas
      • oranges

    • Links

      [text](https://www.link.to/where/you/want)
      

      Weblab documentation


    • ![alternative text](https://www.link.to/image)
      

      image example


    • Find out more about markdown syntax here.