How to write a Pseudocode

I want to learn how to write pseudocode, but my lecturer didn't actually teach us anything about pseudocode, and my exam needs us to write pseudocode for our programme. The following link shows the work I need to do to write pseudocode.
Snap Program

What is pseudocode

How to write

NOTE: AS BRIAN SAID, THIS IS WRONG.

Pseudocode is just any way of putting an algorithm on paper, without writing valid code.

for example, for a Snap! program that asks for someone's age, I might write

(when green flag (
                  (ask&wait 'age?)
                  (write (if (>= age 18) 'Adult 'Child))
                 )
)

Or:

[scratchblocks]
when green flag clicked::control
ask [age?] and wait
say(if ((age) ≥ (18)::operators)then [adult] else [child]::control)
[/scratchblocks]

[scratchblocks]
when green flag clicked::control
ask [age?] and wait
say(if ((age) ≥ (18)::operators)then [adult] else [child]::control)
[/scratchblocks]

Do you mean writing? Other than that, you're right :wink:

How about this for an interesting project: create a formal pseudocode syntax, and an interpreter that will execute it as a program :smirk:

Yeah... I'm gonna hold off on that until I finish The Wizard Book.

Edit: I might make something basic w/ JSON:

code
[
    [
        "define",
        "name"
    ],
    [
        "ask",
        "what is your name?"
    ],
    [
        "set",
        "name",
        [
            "answer"
        ]
    ],
    [
        "ifelse",
        [
            "=",
            "var",
            "BlueBaritone21"
        ],
        [
            "say",
            "Hello, Sir."
        ],
        [
            "say",
            [
                "join",
                "Hello, ",
                [
                    "var",
                    "name"
                ]
            ]
        ]
    ]
]
(Error-filled) Script Pic

Guys.

I'm pretty sure @tp077840 is talking about the specific programming language that the College Board (wrongly imho) calls "pseudocode" in the Advanced Placement Computer Science Principles exam.

@tp077840, you might find the Snap! Cheat Sheet helpful.

Oh, crud. I forgot about that.

[offtopic]I found some incorrect information there, (Taken from the cheat sheet)
image
But, (Taken from the relabel menu)
image

[/offtopic]

Yeah, true. The whole reason they're buried inside relabel is that we use writing them as an exercise in BJC.

Personally, I'd rather not mention them at all than lie about them.

Well, it wasn't a lie when we wrote it.

In the period from BYOB 3 to Snap! 4, BJC was the main driving force in Snap! development. (BJC paid for Jens to build Snap! 4.0.) Since then, though, we have had two conflicting goals: (1) Allow Snap! to support a growing user community outside of BJC; (2) Not have to rewrite BJC for each new Snap! version.

Hiding ≤ etc. behind relabel was our way to accomplish both goals with respect to those operators. You can think of it as an abstraction over Snap!, providing a language that looks like Snap! 4.0 while really being more powerful.

We were not always so successful at accomplishing both goals. For example, at one point Jens got seriously fixated on minimizing the width of the palette (he'd always worried about minimizing its height), so one morning the BJC team woke up to a new Snap! in which the names of the HOFs had been drastically shortened. I got a lot of grief from the EDC people about that, because they had to recreate all the pictures of blocks and scripts involving HOFs. As an example in the other direction, at one point Jens and Jadga wanted to move the list command blocks (ADD and friends) up above the HOFs, and I just dug in my heels and wouldn't let them.

But still, the ≤ solution remains an elegant way to keep both goals in mind at once. In some ways it's a little embarrassing, but in other ways I'm still proud of it.

Thank you all for helping me. Appreciates it.:pray::pray:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.