24 lines
561 B
Plaintext
24 lines
561 B
Plaintext
//ww:run-exit 40
|
|
// Migrated from 700_e2e row 125.
|
|
package main;
|
|
import bytes;
|
|
fn main() i32 = {
|
|
let buf: [4]u8;
|
|
buf[0] = 1u8; buf[1] = 2u8; buf[2] = 3u8; buf[3] = 4u8;
|
|
let needle: [2]u8;
|
|
needle[0] = 3u8; needle[1] = 4u8;
|
|
let r1: (i32 | void) = bytes.index(buf[0:4], 3u8);
|
|
let r2: (i32 | void) = bytes.index(buf[0:4], needle[0:2]);
|
|
let a: i32 = 99;
|
|
let b: i32 = 99;
|
|
match (r1) {
|
|
case let i: i32 => a = i;
|
|
case void => a = -1;
|
|
};
|
|
match (r2) {
|
|
case let i: i32 => b = i;
|
|
case void => b = -1;
|
|
};
|
|
return a * 10 + b + 18;
|
|
};
|