Purebasic a Beginner's Guide to Computer Pyogramming by Gary Willoughby

By Gary Willoughby

Similar nonfiction_12 books

The Cambodian Version of the Ramayana

Released within the yr 2004, The Cambodian model of the Ramayana is a important contribution to the sphere of Asian reports.

Additional info for Purebasic a Beginner's Guide to Computer Pyogramming

Sample text

The new value of ‘NumberOne’ (40) is then echoed to the Debug Output window. * (Multiplication) The multiplication operator is used to multiply two values together and like the minus operator cannot work with Strings. l = NumberOne * NumberTwo Debug NumberThree The debug output should be ‘125’ because in this example we’ve multiplied ‘NumberOne’ by ‘NumberTwo’ (5*25=125). Again a shortcut can be used to multiply a variable by a specified number. l = 50 NumberOne * 3 Debug NumberOne Here ‘NumberOne’ is assigned the value of ‘50’ then ‘NumberOne’ is multiplied by ‘3’ using the multiplication operator.

A bigger array just needs a bigger range in the first line of the ‘For’ loop definition. l(2, 2) Numbers(0, Numbers(0, Numbers(0, Numbers(1, Numbers(1, Numbers(1, Numbers(2, Numbers(2, Numbers(2, 0) 1) 2) 0) 1) 2) 0) 1) 2) = = = = = = = = = 1 2 3 4 5 6 7 8 9 For x = 0 To 2 For y = 0 To 2 Debug Numbers(x, y) Next y Next x As long as the counter variables are different names, you can nest as many ‘For’ loops as you wish. The unique configurability of ‘For’ loops make them powerful to use and extremely useful for looping code a user defined amount of times.

It does, and returns a true value, so the first line after the ‘If’ keyword is executed. If this comparison returned false then the code after the ‘Else’ keyword would of been executed. To finished the ‘If’ statement off, you must use the ‘EndIf’ keyword, as this defines the end of the ‘If’ statement. Everything Is True? As you have read earlier on, and generally in PureBasic, ‘1’=True and ‘0’=False. While this is correct, ‘If’ statements are a special case regarding what they recognized as true.