Line 1: name ← INPUT("What is your name?") Line 2: IF name = "Alice" THEN Line 3: { Line 4: DISPLAY("Welcome to Wonderland!") Line 5: } ELSE Line 6: { Line 7: DISPLAY(CONCAT(CONCAT("Why hello, ", name), "!")) Line 8: }
Just type JavaScript in the JavaScript side, and you should see code appear on the right. If I implemented the syntax you're using (which should be most syntax), it should show up translated into APCSP code.
We also support some APCSP functions, such as RANDOM, DISPLAY, and INPUT.
If you want to test out some simple input/output code, you can use DISPLAY and INPUT, or if you want it to feel more like JavaScript, I've made aliases for those as prompt and display.
I've also inputted APCSP style robot code, which you can access by calling methods such as ROTATE_RIGHT or MOVE_FORWARD or the more JS-like alternatives I've put in which are forward(), right(), left(), etc.
For problems, try typing:
The full list of robot functions is:
Some structures, such as objects, aren't supported in the APCSP syntax, so YMMV.
If you want to be impressed with my overachieving in creating this tools, take some of the list methods for a spin.
For example, the following code fragments should work.
let fruits = ['apple','pear','persimmon','banana'];
let pfruits = fruits.filter(fruit => fruit[0]=='p');
List methods I've implemented include: