This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class TableArray { | |
public static void main(String[] args) { | |
String[][] table = new String[4][5]; | |
String kols[] = {"NRP", "Nama", "Alamat", "Telp", "Email"}; | |
Scanner scan = new Scanner(System.in); | |
for (int bar = 0; bar < table.length; bar++) { | |
for (int kol = 0; kol < table[bar].length; kol++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const A = [ | |
[ 0, 0, 0, 1, 0, 0 , 0], | |
[ 0, 0, 1, 0, 1, 0 , 0], | |
[ 0, 1, 0, 0, 0, 1 , 0], | |
[ 1, 0, 0, 0, 0, 0 , 1], | |
[ 1, 1, 1, 1, 1, 1 , 1], | |
[ 1, 0, 0, 0, 0, 0 , 1], | |
[ 1, 0, 0, 0, 0, 0 , 1], | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function assertNever(never: never) { | |
console.error("Never touched"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Notice here that we have to keep passing the type | |
store.dispatch<SetTokenAction>({ | |
type: "auth/set-token", // However, TypeScript will force you to use the correct type for SetTokenAction | |
payload: "userToken" | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const setTokenAction(payload: string){ | |
return { | |
type: "auth/set-token", | |
payload | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const setTokenAction = createAction<SetTokenAction>("auth/set-token"); | |
export const flushTokenAction = createAction<FlushTokenAction>( | |
"auth/flush-token" | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface PayloadedAction<TType, TPayload> { | |
type: TType; | |
payload: TPayload; | |
} | |
export interface Action<TType> { | |
type: TType; | |
} | |
export function createPayloadedAction< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface SetTokenAction { | |
type: "auth/set-token"; | |
payload: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const token = ( | |
state: AuthStore["token"] = null, | |
action: Auth.TokenActions | |
): AuthStore["token"] => { | |
switch (action.type) { | |
case "auth/set-token": | |
return action.payload; | |
case "auth/flush-token": | |
return null; | |
default: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface PayloadedAction<TType, TPayload> { | |
type: TType; | |
payload: TPayload; | |
} | |
export interface Action<TType> { | |
type: TType; | |
} |