Lots of compiler errors I don't know how to fix

I have 2 scripts that have errors I have never encountered before,
the first script makes an animated character wander around an object, the errors are occurring in line 7-14

using UnityEngine;
using System.Collections;

public class RandomWander : MonoBehaviour {

	public GameObject init;
	private Transform initpos = init.GetComponent<Transform>();
	private float time = 10;
	private boolean update = true;
	public float radius;
	float lowX = initpos.x - radius;
	float highX = initpos.x + radius;
	float lowZ = initpos.z - radius;
	float highZ = initpos.z + radius;
	
	// Use this for initialization
	void Start () {
		anim = gameObject.GetComponent <Animator>();
	}
	
	// Update is called once per frame
	void Update () {
		if (update) {
			Vector3 pos = getRandomPos();
		}
		
		gameObject.LookAt(pos);
		
		if (gameObject.transform.position == pos){
			time -= Time.deltaTime;
			anim.SetBool("Walking", false);
			if (time <= 0.0f){
				update = true;
				time = 10.0f;
			}
		} else {
			transform.position += transform.forward * 0.2f;
			anim.SetBool("Walking", true);
		}
	}
	
	Vector3 getRandomPos(){
		Vector3 pos;
		pos.x = Random.Range(lowX, highX);
		pos.y = initpos.y;
		pos.z = Random.Range(lowZ, highZ);
		return pos;
	}
}

Second script allows the FPS controller to attack these NPC’s but there are errors with line 22 and 29
using UnityEngine;
using System.Collections;

public class SwordAttack : MonoBehaviour {

	public int frame = 0;
	public GameObject sword;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		//replace with left key check
		if (Input.GetMouseButtonDown(0) && frame <= 10){
			sword.transform.position += sword.transform.forward*0.1f;
			++frame;
		} else if (frame >= 11){
			frame = 0;
			sword.transform.position += sword.transform.back*0.1f*frame;
		}
	}

	void OnTriggerEnter(Collider other){
		if (other.gameObject.tag == "Enemy"){
			other.gameObject.GetComponent<Animator>().SetBool("Dead", true);
		}
	}
}

If anybody can resolve these issues it would be greatly appreciated.

you can’t assign fields in a class with fields, you should move the assignment into the Awake method or Start depending on your needs, the below listed should be declared then assigned/set as i mentioned.

// change these declarations

private Transform initpos;
float lowX;
float highX;
float lowZ;
float highZ;

//initialize then in Start or Awake methods
void Awake ()
{
  initpos = init.GetComponent<Transform>();
  lowX = initpos.x - radius;
  highX = initpos.x + radius;
  lowZ = initpos.z - radius;
  highZ = initpos.z + radius;
}

You other issue is trying to use .back and .forwars on a Transform type and not a Vector3 type… like the position of the Transform type. fixed below.

sword.transform.position += sword.transform.position.forward*0.1f;

sword.transform.position += sword.transform.position.back*0.1f*frame;