Skip to main content
added 16 characters in body
Source Link
moonheart08
  • 773
  • 3
  • 18

Rust, 6062 bytes

fn main(){let a=include_str!("a.");print!("{}",a.len()-1)}//

What's happening is the file is including itself as a string during compiletime, and getting the length of itself.

When appended, the extra code is commented out, but still effects the length of the file.

Only works if the file name is 'a.'

Secondary Solution, 63 bytes

fn main(){let a=include_str!(file!());print!("{}",a.len()-1)}//

This solution doesn't use a hardcoded filename, losing 3 bytes1 byte.

Rust, 60 bytes

fn main(){let a=include_str!("a.");print!("{}",a.len()-1)}//

What's happening is the file is including itself as a string during compiletime, and getting the length of itself.

When appended, the extra code is commented out, but still effects the length of the file.

Only works if the file name is 'a.'

Secondary Solution, 63 bytes

fn main(){let a=include_str!(file!());print!("{}",a.len()-1)}//

This solution doesn't use a hardcoded filename, losing 3 bytes.

Rust, 62 bytes

fn main(){let a=include_str!("a.");print!("{}",a.len()-1)}//

What's happening is the file is including itself as a string during compiletime, and getting the length of itself.

When appended, the extra code is commented out, but still effects the length of the file.

Only works if the file name is 'a.'

Secondary Solution, 63 bytes

fn main(){let a=include_str!(file!());print!("{}",a.len()-1)}//

This solution doesn't use a hardcoded filename, losing 1 byte.

Added a second solution that doesn't depend on file name
Source Link
moonheart08
  • 773
  • 3
  • 18

Rust, 60 bytes

fn main(){let a=include_str!("a.");print!("{}",a.len()-1)}//

What's happening is the file is including itself as a string during compiletime, and getting the length of itself.

When appended, the extra code is commented out, but still effects the length of the file.

Only works if the file name is 'a.'

Secondary Solution, 63 bytes

fn main(){let a=include_str!(file!());print!("{}",a.len()-1)}//

This solution doesn't use a hardcoded filename, losing 3 bytes.

Rust, 60 bytes

fn main(){let a=include_str!("a.");print!("{}",a.len()-1)}//

What's happening is the file is including itself as a string during compiletime, and getting the length of itself.

When appended, the extra code is commented out, but still effects the length of the file.

Only works if the file name is 'a.'

Rust, 60 bytes

fn main(){let a=include_str!("a.");print!("{}",a.len()-1)}//

What's happening is the file is including itself as a string during compiletime, and getting the length of itself.

When appended, the extra code is commented out, but still effects the length of the file.

Only works if the file name is 'a.'

Secondary Solution, 63 bytes

fn main(){let a=include_str!(file!());print!("{}",a.len()-1)}//

This solution doesn't use a hardcoded filename, losing 3 bytes.

Source Link
moonheart08
  • 773
  • 3
  • 18

Rust, 60 bytes

fn main(){let a=include_str!("a.");print!("{}",a.len()-1)}//

What's happening is the file is including itself as a string during compiletime, and getting the length of itself.

When appended, the extra code is commented out, but still effects the length of the file.

Only works if the file name is 'a.'