🧪Variables LabLAB
Variables Lab
In this lab, you will declare variables for a user profile and print them using formatted output.
Your Task
Declare the following:
Constants (use const or a const block with iota):
maxConnections— a constant int set to100- A
Roleconst block usingiota:Guest = iota,User,Admin(values 0, 1, 2)
Variables:
name— astringrepresenting the user's name (e.g.,"Alice")age— anintrepresenting the user's age (e.g.,25)country— astringrepresenting the user's country (e.g.,"Vietnam")isStudent— aboolrepresenting whether the user is a student (e.g.,true)role— assign it the valueAdmin
Then print everything so the output looks like:
Format Verbs
Use these fmt.Printf format verbs:
%s— for strings%d— for integers%v— for booleans (or any value)
Example
Ctrl+Enter to run
Ctrl+Enter to run