// psuedo code basics
/**
* if what
* action #1
* data
* action #2
* data
* else-if what
* action
* data
* else
* action
* data
* ...more actions
*/
// example
/**
* case "east"
* if allowed and "east" is direction
* print movement action
* "Jake goes east to Fakeville."
* change Actor.location
* "Fakeville"
* no case
* print warning statement
* "Can't go there."
*/
// code implementation
const move = dir => {
switch (dir) {
case "east":
// movement logic...
break;
default:
console.log("Can't go there.");
}
}
Editor is loading...