
ex) 논리 연산자가 뭐예요? 왜 써요? 종류는요?Code that runs only when specific conditions are met. For example, if statements and while loops contain conditional code that runs only if or while a condition is true. 특정 조건을 만났을 때만 작동하는 코드. 예를 들면, if문과 while 반복문은 조건이 참인 경우에만 실행되는 조건문이 포함되어 있다.
If you hit a traffic jam, you may need to change your route.
In code, you plan for different conditions using an if statement.
If the light is green, Byte walks forward across the street.
if lightIsGreen {
Byte walks forward
across the street
}
Here, lightIsGreen is true, so Byte walks forward.
if lightIsGreen {
moveForward()
} else {
wait
}
To write an if statement, use if and add your condition, which can be true or false. Then add the if block-the commands that run if the condition is true. If condition is false, you can use else to specify other code to run.
To execute someone means to kill them as a punishment for a serious crime. But, if you execute a difficult action or movement, you successfully perform it. 사람의 경우 사형하다로 쓰이며, 행동이나 행위와 함께 쓰이는 경우 성공적으로 해내는 것(실행하다)A type that has a value of either true or false. For example, 9 < 7 returns a Boolean value of false because 9 is not less than 7 참 혹은 거짓 중 하나의 값을 가지는 자료형. 예를 들면 '9 보다 7이 크다'는 9는 7보다 크지 않으므로 거짓이라는 불리언 값을 반환한다. An outline of an item, such as a gem, switch, or block, in the puzzle world. A wireframe is used to indicate the possibility that the item could randomly appear each time the puzzle is run. 퍼즐 월드의 블록이나 스위치, 쳄과 같은 아이템의 외곽선을 말한다. 와이어프레임은 퍼즐이 작동할 때마다 아이템들이 무작위로 나타날 수 있는 가능성을 보여준다.If statement is a code structure used to run code based on the value of one or more conditions. The first block of code in an if statement is the if block. An if statement might also contain other blocks that provide additional checks, such as an else block and else if block. 하나 혹은 그 이상의 조건의 값을 기준으로 작동하기 위해 사용하는 코드 구조. if문의 첫번째 코드블록은 if 블록이다. if문에는 또한 else 블록이나 eles if 블록처럼 추가적인 확인을 제공하는 다른 블록도 포함될 수 있다.
else if is a block of code in an if statement, used to check a condition that isn't checked by the if block or any other else if blocks. if 블록이나 else if 블록에서 확인하지 않은 조건을 확인하는 데 사용하는 코드 블럭
(예제 문제들 중 더 클린하게 작성할 수 있을 지 고민이 필요한 코드 모음)

func collectOrToggle() {
moveForward()
moveForward()
if isOnClosedSwitch {
toggleSwitch()
} else if isOnGem {
collectGem()
}
}
collectOrToggle()
TurnLeft()
moveForward()
moveForward()
turnLeft()
collectOrToggle()
turnRight()
moveForward()
turnRight()
collectOrToggle()Conditional Code(조건문)는 특정한 조건을 마주했을 때 작동하는 코드 이다.
ex) if -> 이 조건을 만족한다면 다음 코드를 실행해! while -> 이 조건을 만족하는 동안 이 코드를 반복해!
이사, 멋사자소서 준비로 좀 오래 걸린...
22.08.07, 10, 11, 26 TIL 끝!
썸네일은 Banner Maker로 제작하였습니다.