Skip to main content

Using Code Blocks on Flashcards

Code blocks can be included on flashcards using the hierarchy of parents (for the front) and multi-line flashcards (for the back).

Written by Soren Bjornstad

Because code blocks are entire bullets of their own, they cannot be placed within the same bullet as a flashcard arrow. This may make it hard to see how to use them in flashcards. Fear not, RemNote’s automatic display of hierarchy on flashcards and its multi-line cards feature still make it easy to create flashcards for code.

Code on the front of a flashcard

To put code on the front of a flashcard – say, to ask comprehension questions about some code or practice spotting an error in it – put the code block first, then indent underneath it and create a question and answer there.

In the editor, a console.log code block with a question and its answer indented as a single bullet directly beneath it.

When it comes time to practice the flashcard, you’ll see it just like this:

The same card in the practice queue: the code block sits above the question, the answer is hidden behind a question mark, and a 'Show Answer' button waits at the bottom.

Code on the back of a flashcard

To put code on the back of a flashcard – say, to practice writing a small snippet of code that accomplishes some task or remembering the name of a library function – write the front of the flashcard as normal, then press Enter to create a multi-line flashcard and create the code block there. A multi-line flashcard with only one line on the back is just fine!

In the editor, a question bullet ending in a downward arrow, with the answer code block indented beneath it as the back of a multi-line flashcard.

That looks like this when you practice it:

The same card when practiced, where the answer code block is replaced by a single small numbered box standing in for the hidden line.

This method works especially well with the Concept/Descriptor Framework:

The Concept/Descriptor Framework in the editor: a Tuple Unpacking concept nested under Python, with two descriptor bullets, 'form' and 'how to use to swap the values of a and b', each answered by its own indented code block.
Did this answer your question?