Sunday, 12 January 2014

Class

Untuk apa/bisa digunakan untuk apa?

Class bisa digunakan sebagai panduan pengisian. Seperti ngisi data di microsoft excel
Contoh perhatikan rani, sori perhatikan data berikut ini:


Nama Umur Suku Status
Saya      
Kamu      
Dia      

Begimana caranya?
1. Pertama defenisikan class
Public Class Orang
    'properties
    Public Umur As Integer
    Public Suku As String
    Public Status As String

End Class
 
2. Masukin saya sebagai orang, trus define(dim) umur saya, suku saya, status saya. Tampilkan status saya
Module Module1

    Sub Main()
        Dim saya As New Orang
        saya.Umur = 29
        saya.Suku = "Batak"
        saya.Status = "Belum Menikah"
        Console.WriteLine(saya.Status)
        Console.ReadLine()
    End Sub

End Module

What makes a man, man

What makes a man, man?
What makes a spirit, spirit?

Don't easily give up on your brain

Something may be difficult to grasp at first but should be easy enough if you stick at it.

Apa perbedaan sub procedure dengan function?

Simple, sub tidak return value, function return value.

Saturday, 11 January 2014

Terminologi programming

Modules = class with super power
Class =
- is the blueprint
- container of related method
Contoh:
console
Object is an instance of a class

Looping

Components

Looping's components: (a = b x c)
(a) what to be looped(b)
(b) how many times (c)
- Unknown
- Known

(c) result
(d) exit condition or stop condition

Which one?
If you know what to be looped and how many times you loop and what to be looped, you can use for.
If you don't know how many times you loop but know what to be looped and the what result you want, you can use while.

For: a, b, c
While: d

Examples
Python looping
- Python For
Example (Python)
>>> for i in range (0,2):
    print i

  
0
1
- Python While
 Example (Python):
>>> x=1
>>> while x < 3:
    x = x + 1
    print x

  
2
3

C Looping
- For
Usage: for (start counter; end counter; how to get to end counter)

Example:

- While
 This the most basic loop in C.
check first, do last.

Example:



- do..While
do.. While loop is just like while except the condition to test is behind
do first, check later




Preposition

AT / IT / ON