pxt-calliope/docs/blocks/loops/for-of.md
2019-01-18 07:52:48 -08:00

358 B

@extends

#examples

Example: Find the highest number

Find the highest number in a list of numbers. Display the highest number on the screen.

let list: number[] = []
let highest = 0
highest = 0
list = [5, 8, 6, 2, 4, 3, 7, 1]
for (let value of list) {
	if (value > highest) {
        highest =  value
    }
}
basic.showNumber(highest)