← 수업 제작 도구
홈 › Components › Action Button (행동 버튼) › 화면 3

화면 3. Action Button.lastValue [source]

원본: Computation Layer 문서(Action Button (행동 버튼)) · Try It (원본 화면)

화면 번호3 / 12
문서 항목 설명 (원문)lastValuekey: string Gets the last value captured for a variable that was defined using the "capture" sink.

1. 화면 캡처 (빨간 번호 = 아래 표의 번호)

화면 3 캡처

화면에 적힌 영어 문구(원문):

2. CL이 입력된 곳

코드 안의 회색 줄은 원문 영어 주석이고, 파란 줄은 그 영어 주석의 번역이며, 연분홍 줄은 코드가 하는 일의 설명이다.

번호이름종류CL 코드 원문, 번역, 설명
1historyGraph그래프
# The action button named "captureButton" knows that the "history" of "xCoord"
# refers to the number "a" in a graph component that was defined there.
# "lastValue" is used similarly to "history", but it sources a single number,
# not a list – the last number captured.
▷ "captureButton"이라는 행동 버튼은 "xCoord"의 "기록(history)"이 그곳에서 정의된 그래프 구성요소의 숫자 "a"를 가리킨다는 것을 안다. "lastValue"는 "history"와 비슷하게 쓰지만, 배열(List)이 아니라 숫자 하나, 즉 마지막으로 기록된 숫자를 가져온다.

number("a_{recent}"): captureButton.lastValue("xCoord")
▶ 그래프의 변수 a_{recent}는 captureButton이 "xCoord"라는 이름으로 마지막에 기록한 값(captureButton.lastValue("xCoord"))으로 한다.
number("이름")은 그래핑 계산기 안의 변수 값을 정하고, lastValue("이름")은 capture로 정한 변수에 마지막으로 기록된 값을 가져온다.
number("b_{recent}"): captureButton.lastValue("yCoord") ▶ 그래프의 변수 b_{recent}는 captureButton이 "yCoord"라는 이름으로 마지막에 기록한 값(captureButton.lastValue("yCoord"))으로 한다.
2captureButton행동 버튼
# We're telling the action button to capture the variables "a" and "b"
# from a graph component named "historyGraph". "xCoord" and "yCoord"
# are names that capture, lastValue, and history all share.
▷ 행동 버튼이 "historyGraph"라는 그래프 구성요소의 변수 "a"와 "b"를 기록하도록 한다. "xCoord"와 "yCoord"는 capture, lastValue, history가 모두 함께 쓰는 이름이다.

capture("xCoord"): historyGraph.number("a")
▶ "xCoord"라는 이름으로 기록할 값(capture("xCoord"))은 그래프 구성요소 historyGraph의 변수 a의 숫자 값(historyGraph.number("a"))으로 한다.
capture("이름")은 행동 버튼을 누를 때마다 기록해 둘 변수를 정하고, 기록은 나중에 history로 가져온다. historyGraph.number("a")는 그래프 구성요소 historyGraph의 변수 a의 숫자 값을 알려 준다. 버튼을 누를 때마다 변수 a의 값이 "xCoord"에 기록된다.
capture("yCoord"): historyGraph.number("b") ▶ "yCoord"라는 이름으로 기록할 값(capture("yCoord"))은 그래프 구성요소 historyGraph의 변수 b의 숫자 값(historyGraph.number("b"))으로 한다.
버튼을 누를 때마다 historyGraph의 변수 b의 값이 "yCoord"에 기록된다.