|
Web+ Tutorial
|
Lesson 1.1 - Assigning and Printing the Values of Variables
You can use variables to store values as your programs execute. By the end of this lesson, you will learn how to assign values to variables.
- Description
webset: Assigns the value of a constant or an expression to a variable.
webPrint: Allows you to insert the values of dynamic parameters into your text.
- Syntax
<webSet #variable# = expression> <webPrint> ...#variable#... </webPrint>
- Example
<webSet #age# = 32> <webSet #salary# = 25000.75> <webSet #distance_to_the_moon# = 238857> <webSet #name# = "Anne"><webSet #path# = "C:\temp\"> <webPrint>My name is #name# and I am #age# years old.</webPrint>
- Sample
<webSet #string# = "Hello World! This is Web+."> Output = <webPrint>#string#</webPrint>
- Result:
- Exercise
- Now write a Web+ program to print the words "Hello World!" after assigning them to a variable.
You can try out some Web+ code of your own here.
|
|