<script>
	let x = 0;
</script>

<button on:click="{() => {
	if (true) x += 1;
}}">foo</button>

<p>x: {x}</p>