
Variabel Global dan Lokal
Presentation
•
Computers
•
10th Grade
•
Practice Problem
•
Medium
Afika Rozzaq
Used 2+ times
FREE Resource
8 Slides • 3 Questions
1
Variabel Global dan Variabel Lokal
2
Variabel Global
Variabel yang dideklarasikan di luar function. Variabel ini bisa digunakan semua function di dalam satu file. Deklarasi variabel global sebaiknya diatas function main.
3
Variabel Lokal
Variabel yang dideklarasikan di dalam compound statement dari function, loop, atau percabangan.
Variabel tersebut hanya bisa digunakan di dalam function atau di antara tanda kurung kurawal ( {….} ) yang mengelilinginya.
4
Ruang lingkup variabel adalah jangkauan akses variabel tersebut :
Ada variabel yang bersifat global: ia bisa diakses dari bagian program mana pun dari berbagai file.
Ada variabel yang bersifat lokal: ia hanya bisa diakses oleh sebagian kode program tertentu dan tidak bisa diakses dari bagian yang lain.
5
Contoh:
nama variabel global dan variabel lokal sama. Namun, tidak akan terjadi error. Ketika nama fungsi dipanggil, maka output nya adalah Melati.
6
Fill in the Blanks
Type answer...
7
Contoh:
Kalian bisa mendeklarasikan variabel lokal dengan nama yang sama di beberapa function berbeda. Walaupun namanya sama, setiap variabel lokal di function yang berbeda dianggap sebagai beberapa variabel yang berbeda. Contoh penggunaan variabel lokal dan variabel global bisa kalian lihat di samping.
8
Match
Perhatikan gambar berikut :
Output baris ke 24 adalah...
Output baris ke 25 adalah...
Output baris ke 26 adalah...
Melati
Anggrek
Tulip
Melati
Anggrek
Tulip
9
Fill in the Blanks
Type answer...
10
Sampai disini, semoga kalian dapat memahami perbedaan variabel global dan variabel lokal...
11
Variabel Global dan Variabel Lokal
Show answer
Auto Play
Slide 1 / 11
SLIDE
Similar Resources on Wayground
10 questions
materi komputer
Presentation
•
10th Grade
6 questions
Computer Thinking
Presentation
•
10th Grade
10 questions
Integrasi Aplikasi Perkantoran
Presentation
•
10th Grade
5 questions
cung cố kiến thức bài học
Presentation
•
10th Grade
9 questions
Informatika SMK Sistem Bilangan
Presentation
•
10th Grade
7 questions
PENGENALAN KOMPONEN PEMROGRAMAN
Presentation
•
10th Grade
6 questions
SISKOM - MULTIPLIXER & DECODER
Presentation
•
10th Grade
Popular Resources on Wayground
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
10 questions
MyPath Diagnostic Overview
Presentation
•
6th - 8th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Adding and Subtracting Decimals
Quiz
•
5th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
21 questions
Lab Safety
Quiz
•
10th Grade
Discover more resources for Computers
20 questions
Early Computing
Quiz
•
7th - 12th Grade
20 questions
Module 1 Topic 1 Vocabulary
Quiz
•
9th - 12th Grade
10 questions
Exploring Computer Hardware and Software Components
Interactive video
•
6th - 10th Grade
39 questions
Safety Review
Quiz
•
9th - 12th Grade
20 questions
Digital Citizenship
Quiz
•
8th - 12th Grade
22 questions
Electronic Computing
Quiz
•
8th - 12th Grade