Note: This is a pre-release of BagaWork. Many things will likely change before the first stable release.

Multiplication Table

This example shows how to create an app that shows the multiplication table for a number.

Open in Online Editor
class MyApp extends App{
	
	createStartPage(){
		return StartPage
	}
	
}
class StartPage extends Page{
	
	x = 0
	
	createGui(){
		return Rows.children(
			Space,
			Columns.children(
				Space,
				Button.text(`-`).onClick(p.decrement),
				Space,
				Text.text(`${p.x}`),
				Space,
				Button.text(`+`).onClick(p.increment),
				Space,
			),
			Space,
			Text.text(`0 * ${p.x} = ${0 * p.x}`),
			Text.text(`1 * ${p.x} = ${1 * p.x}`),
			Text.text(`2 * ${p.x} = ${2 * p.x}`),
			Text.text(`3 * ${p.x} = ${3 * p.x}`),
			Text.text(`4 * ${p.x} = ${4 * p.x}`),
			Text.text(`5 * ${p.x} = ${5 * p.x}`),
			Text.text(`6 * ${p.x} = ${6 * p.x}`),
			Text.text(`7 * ${p.x} = ${7 * p.x}`),
			Text.text(`8 * ${p.x} = ${8 * p.x}`),
			Text.text(`9 * ${p.x} = ${9 * p.x}`),
			Space,
		)
	}
	
	decrement(){
		p.x -= 1
	}
	
	increment(){
		p.x += 1
	}
	
}