Skip to content

Sub-Question Blocks - #62

Open
ReeseHatfield wants to merge 4 commits into
mainfrom
rh-question-block
Open

ReeseHatfield wants to merge 4 commits into
mainfrom
rh-question-block

Conversation

@ReeseHatfield

Copy link
Copy Markdown
Collaborator

I have finally gotten around to implementing subquestions based on #15. This needs to be done with higher order functions, so it looks a little weird, but I think it's pretty elegant.
image

Code:

#e.question-block([Use the block to answer the following questions:],
  () => e.short-answer(
    "What is the time complexity of the method shown above?", 
    lines: 2, 
    points: 2
  ),
  () => e.multiple-choice(
    "Which data structure would optimize this code?",
    points: 1,
    cols: 2,
    [Array List],
    [Hash Map],
    [Linked List],
    [Binary Tree]
  )
)

It's basically a wrapper that manages some state, that is then used for a conditional render in the question function that is composed when you pass HOFs into question-block

Closes #15

@ReeseHatfield ReeseHatfield self-assigned this Dec 4, 2026
@ReeseHatfield ReeseHatfield added the enhancement New feature or request label Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question Block

1 participant