Skip to content

BGG23/Variables-and-Comparison-Operators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

Variable and Comparison Operators

Task 1

Assign a variable with each datatypes covered in the previous workshop The datatypes previous covered were “Boolean”, “String”, “Int”

  • $BoolanVar = $True
  • $StringVar = "This is a string"
  • $IntVar = 42

image


Task 2

List all variables currently loaded in to memory. The noun within the cmdlet is “Variable”

  • Get-Variable

image

  • Get-Variable BoolanVar

image

  • Get-Variable StringVar

image

  • Get-Variable IntVar

image


Task 3

Multiple two Int variables together PowerShell can perform basic maths operators, such as “+”, “-“ and “*”

  • $IntVar1 = 4
  • $IntVar2 = 10
  • $IntVar1 * $IntVar2

image


Task 4

First declare two Int variables. Then divided the first variable by the second and assign the result to a variable named $VariableResult The easiest way to do this is within the Integrated Scripting Environment (ISE) using multiple lines of code

  • $IntVar3 = 10
  • $IntVar4 = 2
  • $VariableResult = $IntVar3 / $IntVar4

image

image


Task 5

Typecast a Variable as a “String” and assign it a value of 5 Remember to normal brackets [] rather than curly brackets {} when typecasting a variable

  • [String]$TypecastVar = 5

image


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published