[Java] progate java L1 basic summary cosole.log, difference between variables and constants, if statement

less than 1 minute read


Use with console.log(); Display inside () on console If you want to display the character string as a reminder, enclose the character string in “” like console.log(“”)

○ console.log (“Aiueo”) ⇨ Aiueo is displayed × console.log (aiueo) ⇨ reference error

Value declaration Variable let and constant const

When declaring a value, declare it with let or const

let numberA = 1; const numberB = 2;

There is a difference between these two, let can be updated but const cannot be updated.

Update value

Variables can have their values updated let numberA = 1; NumberA is 1 at this point,

numberA = 10; Now numberA is 10 instead of

if statement

if (condition) {process} ← do not add semicolon {Condition} is executed when (condition) is satisfied

Example condition a>=b a is above a<b a is below b

Use else if to add more conditions else if (condition) {processing} ← Do not add semicolon

Use else to perform processing when the conditions are not met If all the conditions of if and elseif are not met, else processing is executed. else {processing}