Pickcode VL
Pickcode Visual Language (VL), is our experimental language for transitioning students from block to text based programming. To learn the basics of Pickcode VL, we'd suggest using the provided Intro to Pickcode VL lessons, which guide you through the basics of each project type.
Editing code
- To add a line of code, press any green plus button
- In the options that appear, select the type of code you want.
- Press the grab button on the left side of a line of code to bring up the menu.
- Press the red trash can button to delete a line of code. Press the button again to confirm deletion.
- Drag on the grab button of a line of code to move a line of code.
- While a line of code is selected, press the button at the top of the editor to copy it.
Keypad
- abc: Enter a string
- var: Select a variable
- 123: Number
- +: Addition/concatenate
- ==: Equals
- ,: Comma
- .: Select a method/field from an object
- ( or ): Insert parentheses
- !=: Not equals
- -: Subtraction/negation
- *: Multiply
- /: Divide
- T/F: Boolean (true/false)
- or: Logical or
- and: Logical and
- not: Logical not
- >: Greater than
- <=: Less than or equal
- >=: Greater than or equal
- mod: Modulo
- ^: Exponentiation
- Colors icon: Insert a color
- File icon: Pick an available file name
Statement Types
call
: Execute a function, ignoring its return valueset
: Update the value of a variableif
: Execute code if a condition is trueelse
: Execute code if the condition in the associated if statement is falsefor
: Execute code repeatedly, updating the loop variable with each element in a listvar
: Create a new variable and initialize it with a valuewhile
: Execute code repeatedly, as long as a condition is truereturn
: End the execution of a function and return the value to the callerfunction
: Add a function. Functions have a name, an (optional) list of named parameters with types, a body, and a return typecomment
: Add a comment. A comment is text that is not used in the execution of the program
Chat
Chat projects are for displaying output in message bubbles, similar to what you'd see in a phone's texting app.
chat.send(prompt: String)
: Send chat message to the chat windowchat.ask(prompt: String) returns String
: Showprompt
in the chat window, wait for the user to enter a message and return the user's responsechat.multipleChoice(prompt: String, options: List) returns String
: Showprompt
in the chat window with each option in theoptions
list displayed. Wait for the user to select an option and return the user's choice
Paint
Paint projects are for creating drawings with a simplified version of turtle
graphics.
paint.forward(dist: Number)
: Move paint brush forward bydist
pixels, marking the canvaspaint.right(angle: Number)
: Rotate orientation of paint brush right byangle
degreespaint.left(angle: Number)
: Rotate orientation of paint brush left byangle
degreespaint.goto(x: Number, y: Number)
: Move paint brush to coordinates (x, y) without marking the canvaspaint.plot(f: Function, startX: Number, startY: Number)
: Functionf
must take Number parameterx
, returning a number for the y coordinate of the point to be drawn at that x coordinatepaint.plot2d(f: Function, startX: Number, startY: Number, endX: Number, endY: Number)
: Functionf
must take Number parametersx
andy
, returning a string corresponding to the color to be drawn at coordinate (x, y)paint.x
: Current X coordinate of the paint brush (default: 0)paint.y
: Current Y coordinate of the paint brush (default: 0)paint.angle
: Current orientation of the paint brushpaint.color
: Current color of the paint brush (default: #000000 (black))paint.width
: Current width of the paint brush (default: 5)paint.speed
: Current speed of the paint brush (default: 5)
Game
onKey(key: String, handler: Function)
: Callhandler
whenever keyboard keykey
is pressedbackgroundColor
: Current background color of the gameaddSprite(s: Sprite)
: Add Sprites
to the game screenremoveSprite(s: Sprite)
: Remove Sprites
from the game screenaddTextbox(t: Textbox)
: Add textboxt
to the game screenremoveTextbox(t: Textbox)
: Remove textboxt
from the screenaddTimer(handler: Function, intervalMS: Number)
: Callhandler
everyintervalMS
millisecondsclear()
: Remove all sprites and textboxes from game screenwidth
: Width of the game screen (default: 400)height
: Height of the game screen (default: 300)
Sprite
onTap(handler: Function)
: Callhandler
whenever sprite is clickedx
: X coordinate of Sprite. (0,0) is the top left of the screeny
: Y coordinate of Sprite. (0,0) is the top left of the screenw
: Width of spriteh
: Height of spritecolor
: Color of spriteimage
: Image file for sprite's backgroundzIndex
: Z index of sprite. Sprites with higher Z indexes appear above others if they are overlappingisTouching(other: Sprite)
: Returns true if the current sprite is overlappingother
TextBox
x
: X coordinate of Sprite. (0,0) is the top left of the screeny
: Y coordinate of Sprite. (0,0) is the top left of the screentext
: Text shown in textboxcolor
: Color of textfontSize
: Font size of the text
List
List(...items: Any)
: Create a list initialized with the values of the parameters.get(index: Number) returns Any
: Returns the item at the specified index.get(index: Number, value: Any) returns void
: Changes item at the specifiedindex
tovalue
.add(item: Any)
: Pushesitem
to the end of the list.length() returns Number
: Returns the number of items in the list.map(f: Function) returns List
: Returns the result of callingf
for every item in the listfilter(f: Function) returns List
: Returns a new list, containing only elements for whichf
returns true.join(separator: String) returns String
: Returns a string containing all of the list elements with separator in between them
Map
Map(keys: List, values: List)
: Create a Map with specified keys and values (matched by index).get(key: String) returns Any
: Returns the value with the specified key.add(key: String, value: Any)
: Adds value to the Map with corresponding key.size() returns Number
: Returns the number of key/value pairs in the Map
String
.toUpperCase() returns String
: Convert string to uppercase.toLowerCase() returns String
: Convert string to lowercase.at(index: Number) returns String
:Return character at specifiedindex
.includes(searchStr: String) returns Boolean
: Returnstrue
ifsearchStr
is contained in the string,false
otherwise.indexOf(searchStr: String) returns Number
: Returns index of first instance ofsearchStr
in the string, or -1 if searchStr is not present in the string.split(separator: String) returns List
: Returns a list created by dividing the string into substrings based on the provided separator. Example:"a,b,c".split(",")
returnsList("a", "b", "c")
.slice(startIndex: number, endIndex: number) returns String
: Returns substring of string starting atstartIndex
(inclusive), ending atendIndex
(exclusive)
Built ins
number(value: String) returns Number
: Convert value to a numbernumbers(start: Number, end: Number) returns List
Returns List of numbers betweenstart
andend
, exclusive ofend
Math
math.min(values: List) returns Number
: Returns the smallest number in the listmath.max(values: List) returns Number
: Returns the largest number in the listmath.floor(x: Number) returns Number
: Rounds a number down, returning the greatest integer less than or equal to xmath.ceil(x: Number) returns Number
: Rounds a number up, returning the smallest integer greater than or equal to xmath.randomFloat(min?: Number, max?: Number) returns Number
: Returns a random floating point (decimal) number that is between the provided minimum and maximum: If min and max aren't provided, they default to 0 and 1math.randomInt(min: Number, max: Number) returns Number
: Returns a random integer that is less than the provided maximum, and greater than or equal to the provided minimummath.sqrt(x: Number) returns Number
: Returns the square root of xmath.abs(x: Number) returns Number
: Returns the absolute value of xmath.cos(x: Number) returns Number
: Returns the cosine of x in radiansmath.sin(x: Number) returns Number
: Returns the sine of x in radiansmath.tan(x: Number) returns Number
: Returns the tangent of x in radiansmath.log(x: Number, base?: Number) returns Number
: Returns the logarithm of x in the provided base. If no base is provided, defaults to base e, the natural logarithmmath.parseInt(value: String) returns Number
: Translates a string of digits into a number, interpretting it in base 10. If the string does not start with valid digits, the returned value will be the value NaN (not a number)